更新centos的python版本
2017-02-13 22:52
453 查看
以下脚本在阿里云服务器上测试通过
备注测试 easy_install 命令会有问题
echo “upgrade python version from 2.6.6 to 2.7" yum install -y gcc zlib-devel openssl-devel wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz tar zxvf Python-2.7.9.tgz ./configure --prefix=/usr/local/ make && make install #将系统默认的python指向python2.7版本 mv /usr/bin/python /usr/bin/python2.6.6 ln -s /usr/local/bin/python2.7 /usr/bin/python #解决系统 Python 软链接指向 Python2.7 版本后, #因为yum是不兼容 Python 2.7的,所以yum不能正常工作,我们需要指定 yum 的Python版本 vi /usr/bin/yum #!/usr/bin/python 改成 #!/usr/bin/python2.6.6
备注测试 easy_install 命令会有问题
[xxxx]# easy_install Traceback (most recent call last): File "/usr/bin/easy_install", line 5, in <module> from pkg_resources import load_entry_point File "/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 2603, in <module> File "/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 666, in require File "/usr/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 565, in resolve pkg_resources.DistributionNotFound: distribute==0.6.10 解决办法: rpm -qa |grep distribute 发现没有该包,所以安装 wget https://pypi.python.org/packages/source/d/distribute/distribute-0.6.49.tar.gz tar zxvf distribute-0.6.49.tar.gz && cd distribute-0.6.49 && python setup.py install 再次执行 [xxxx]#easy_install error: No urls, filenames, or requirements specified (see --help) [root@iZ25lx34hhyZ distribute-0.6.49]# pip Traceback (most recent call last): File "/usr/bin/pip", line 5, in <module> from pkg_resources import load_entry_point File "/usr/local/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2877, in <module> working_set.require(__requires__) File "/usr/local/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 698, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/local/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 596, in resolve raise DistributionNotFound(req) pkg_resources.DistributionNotFound: pip==2.7.9 解决办法: easy_install pip 修改版本号 vim /usr/bin/pip 将2.7.9改成你安装的pip即可 当执行ipython notebook …..的时候提示缺少_sqlite3.so 解决办法:可以将机器上原有的so拷过去 find / -name _sqlite3.so cp /usr/lib64/python2.6/lib-dynload/_sqlite3.so /usr/local/lib/python2.7/lib-dynload/
相关文章推荐
- centos 中如何将python更新到最新的版本
- CentOS 6.X更新Python2.7.X版本
- centOS 更新python版本
- centos下更新Python版本的步骤
- CentOS 6更新Python2.7版本
- centos上更新Python版本
- Centos下更新Python版本
- CentOS 6.X更新Python2.7.x版本 安装pip
- CentOS下更新Python版本
- centos下更新Python版本的步骤
- centos下更新Python版本的步骤
- CentOS更新Python版本,同时修复yum不能使用的问题
- CentOS下更新python版本
- centos下更新Python版本的步骤
- centos下更新Python的版本
- centos的python版本更新
- CentOS 5升级python版本(2.4>2.7)
- Centos 5.5升级Python2.4到3.3版本
- 更新CentOS上的Java版本
- CentOS中升级Python到3.2版本