升级python
http://blog.csdn.net/jcjc918/article/details/11022345
安装MySQLdb
sudo yum install MySQL-python
3、安装PIL
1、安装PIL所需的系统库
$ yum install zlib zlib-devel
$ yum install libjpeg libjpeg-level
$ yum install freetype freetype-devel
2、删除Python下安装的PIL
rm -rf /usr/lib/python2.7/site-packages/PIL
rm /usr/lib/python2.7/site-packages/PIL.pth
#或者
rm -rf /usr/lib/python2.7/dist-packages/PIL
rm /usr/lib/python2.7/dist-packages/PIL.pth
#如果/usr/local/python2.7/dist-packages/PIL存在最好也全部删除
3、下载安装PIL
$ wget http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz
$ tar -zxvf Imaging-1.1.7
$ cd Imaging-1.1.7
$ python setup.py build_ext -i #用来进行安装前的检查(此处安装错误,见附录)
$ #修改setup.py
TCL_ROOT = "/usr/lib64/"
JPEG_ROOT = "/usr/lib64/"
ZLIB_ROOT = "/usr/lib64/"
TIFF_ROOT = "/usr/lib64/"
FREETYPE_ROOT = "/usr/lib64/"
LCMS_ROOT = "/usr/lib64/"
$ #安装
$ python setup.py install
附录,使用python setup.py build_ext -i安装时候出现错误:error: command 'gcc' failed with exit status 1 ,明明装了gcc的,怎么会不行呢,然后发觉是failed不是not found,这说明这个错误个gcc没多大关系,应该是缺少某些功能模块,然后谷歌了一下,先后安装了python-devel,libffi-devel后还是不行,最后发觉要安装openssl-devel才行
可如下命令行安装:
yum install gcc libffi-devel python-devel openssl-devel
CompressionError: bz2 module is not available
1.wget https://pypi.python.org/packages/source/T/Twisted/Twisted-14.0.0.tar.bz2#md5=9625c094e0a18da77faa4627b98c9815
2.tar -jxf Twisted-14.0.0.tar.bz2
3.cd Twisted-14.0.0;
python setup.py install
No package 'libffi' found
解决办法: yum install libffi-devel
pip install Scrapy
pip install requests
pip install numpy
theano
sudo yum install python-devel python-nose python-setuptools gcc gcc-gfortran gcc-c++ blas-devel lapack-devel atlas-devel
sudo easy_install pip
sudo pip install numpy==1.6.1
sudo pip install scipy==0.10.1
sudo pip install Theano
在上面的安装过程中出错,“ImportError: No module named pkg_resources”,查看下面的文章:
http://zetawiki.com/wiki/%EB%A6%AC%EB%88%85%EC%8A%A4_pip,_easy_install_%EC%A0%95%EC%83%81%ED%99%94
另外如果出现如下错误“urlopen error unknown url type: https”
安装安装ssl模块,sudo yum install openssl-devel
然后重新编译python
./configure(可选,因为之前已经配置过,按之前的配置来就行了,而且最好按之前的配置配编译安装以免依赖的库需要重新编译安装。)
make
make install
还有这篇文章:http://www.cn cen tos.com/forum.php?mod=viewthread&tid=4580
安装完成Theano之后没法使用,提示: recompile with -fPIC
使用该方法对python重装http://www.andersjing.com/2015/01/centos-6-5%E5%AE%89%E8%A3%85theano%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88/,安装完成后输入python,此时提示:
python: error while loading shared libraries: libpython2.7.so.1.0
vi /etc/ld.so.conf 添加/usr/local/lib
/sbin/ldconfig
/sbin/ldconfig -v
参考:
http://www.cnblogs.com/amboyna/archive/2008/02/06/1065322.html
如果遇到bug
/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libpython2.7.a: could not read symbols: Bad value
参照这篇文章http://www.tuicool.com/articles/JraYBfr 进行重新安装
将python_source_code路径下的setup.py 中 440,441行的代码注释掉
#add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
#add_dir_to_list(self.compiler.include_dirs, '/usr/local/include' )
然后make
如果还不起作用,可以先
sudo mv /usr/local/lib/libpython2.7.a /tmp
这样在编译的时候就不会出现以上错误。
以及这个问题:
http://m.blog.csdn.net/article/details?id=50472451
将
sudo ./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
修改为
sudo ./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
。
但是运行server.py的时候,又出现bug
No module named cv2
这是因为没有安装opencv,先执行如下命令:
yum install gcc, g++, cmake
去这里安装opencv。https://github.com/jayrambhia/Install-OpenCV
安装成功之后,继续报错:
No module named matplotlib.pyplot
pip install matplotlib也可以,但是网速慢,只好放弃。
https://github.com/matplotlib/matplotlib上下源码然后编译。
下载解压后执行python setup.py install即可。
还有scrapy的一些依赖环境也需要安装:
http://blog.csdn.net/figo829/article/details/22724019
解决问题的是这篇文章:
http://www.songyawei.cn/content/1157
又报错误:
No Module Named pydispatch
pip install PyDispatcher安装即可
接着又报错误:
No module named cryptography.hazmat.bindings.openssl.binding
解决问题http://raspberrypi.stackexchange.com/questions/28176/python-and-openssl-error-on-import
接着又报错误:
No module named _sqlite3
数据库启动:/opt/mysql/bin/mysqld
还需要安装lxml
地址:https://mozillazg.com/2013/06/python-install-lxml-libxml-xmlversion.h-No-such-file-or-directory.html