Centos6.9下自定义安装python2.7.6

 

教程:https://blog.csdn.net/mx472756841/article/details/50739599

         https://www.jianshu.com/p/6425d18d3e47

首先下载安装包:wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz

解压:tar xf Python-2.7.6.tar.xz  

非root权限下,下载你需要的python,解压之后。所有的路径都是你自己的路径和适合你的包版本

  1. cd /storage/st20/python-2.7.14 (你解压之后的Python包的位置)
  2. ./configure --prefix=/storage/st20/python-2.7.14 --enable-optimizations --enable-shared CFLAGS=-fPIC (先安装Python,设置环境,安装pip ,后安装caffe)
  3. make -j10
  4. make install -j10(安装快点~)
  5. 修改环境变量:vi  ~/.bash_profile
  6. PATH=/storage/st20/python-2.7.6/bin:$PATH

    LD_LIBRARY_PATH=/storage/st20/python-2.7.6/lib:$LD_LIBRARY_PATH

    export PATH

    export LD_LIBRARY_PATH

  7. 生效:source  ~/.bash_profile
  8. Python2.7.6安装pip

    首先:安装setuptools

  9. wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-12.0.3.tar.gz#md5=f07e4b0f4c1c9368fcd980d888b29a65  
  10. tar -zxvf setuptools-12.0.3.tar.gz 
  11. cd setuptools-12.0.3 
  12.  python setup.py install --prefix=/storage/st20/python-2.7.14
  13. 安装pip wget --no-check-certificate https://github.com/pypa/pip/archive/1.5.5.tar.gz
  14. tar zvxf 1.5.5.tar.gz
  15. cd pip-1.5.5  
  16. python setup.py install --prefix=/storage/st4/python-2.7.14 
  17. 查看安装   pip list
  18. 升级pip pip install --upgrade setuptools pip
  19. pip install nltk 

你可能感兴趣的:(Python)