centos6安装python2.7.8

1安装python
wget http://python.org/ftp/python/2.7.8//Python-2.7.8.tgz
将压缩包解压
进入目录,输入./configure --prefix=/usr/local/python27
make
make install
mv /usr/bin/python /usr/bin/python_old
ln -s /usr/local/python27/bin/python /usr/bin/

修改vi /usr/bin/yum
将#!/usr/bin/python 修改成 #!/usr/bin/python2.6
输入yum 查看是否正常


2 安装pip
wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate
tar -xzvf pip-1.5.4.tar.gz
cd pip-1.5.4
python setup.py install

安装包: NumPy SciPy scikit-learn psycopg2

pip install 提示module 'importlib._bootstrap' has no attribute 'SourceFileLoader' 版本问题,python是3.6时有此问题,降级到2.7

ImportError: No module named setuptools
解决:
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
编译 python setup.py build
python setup.py install


执行pip命令报错
Traceback (most recent call last):
File "./pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/opt/soft/distribute-0.7.3/pkg_resources.py", line 2989, in <module>
working_set.require(__requires__)
File "/opt/soft/distribute-0.7.3/pkg_resources.py", line 726, in require
needed = self.resolve(parse_requirements(requirements))
File "/opt/soft/distribute-0.7.3/pkg_resources.py", line 624, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.5.4

应该是缺少pip1.5.4
执行easy_install pip==1.5.4又报错

Traceback (most recent call last):
File "/usr/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/opt/soft/distribute-0.7.3/pkg_resources.py", line 2993, in <module>
parse_requirements(__requires__), Environment()
File "/opt/soft/distribute-0.7.3/pkg_resources.py", line 624, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: distribute==0.6.10

再安装distribute包
wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.10.tar.gz
cd distribute-0.6.10
python setup.py install

再次安装pip1.5.4

easy_install pip==1.5.4

安装成功

Adding pip 9.0.1 to easy-install.pth file
Installing pip script to /usr/local/python2.7/bin
Installing pip2.7 script to /usr/local/python2.7/bin
Installing pip2 script to /usr/local/python2.7/bin

Installed /usr/local/python2.7/lib/python2.7/site-packages/pip-9.0.1-py2.7.egg
Processing dependencies for pip==9.0.1
Finished processing dependencies for pip==1.5.4

运行pip ,正常

安装scipy报错:numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
yum install lapack lapack-devel blas blas-devel

posted on 2020-01-13 10:52  Helianthus720  阅读(217)  评论(0编辑  收藏  举报

导航