【推薦】
virtualenv的安裝與使用python
問題描述:centos6及其如下的python版本通常是比較低的,使得不符合咱們的配置環境!!!故能夠考慮更換版本
解決步驟:
1.查看本身當前的系統版本
2.到官網下載本身須要的python版本
或者3.5+版本的vim
wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
3.解壓並編譯安裝
tar -zxvf [下載的安裝包]
cd [解壓後的文件]
./configure (安裝yum -y install gcc)
make(這一步會有一點慢)
make installcentos
4.創建軟鏈接,讓默認的python指向咱們本身新安裝的版本
mv /usr/bin/python /usr/bin/python2.6
ln -s /usr/local/bin/python2.7 /usr/bin/pythonpython2.7
或者:
mv /usr/bin/python /usr/bin/python22
ln -s /usr/local/bin/python3 /usr/bin/pythonurl
5.修改yum配置文件
由於yum使用python2,所以替換爲python3後可能沒法正常工做,繼續使用這個python2所以修改yum配置文件(vi /usr/bin/yum)。把文件頭部的#!/usr/bin/python改爲#!/usr/bin/python22保存退出便可.net
python3; 提早安裝(推薦),yum -y install zlib zlib-devel gcc openssl-devel 1.下載python3 wget https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz 2. tar -zxvf [下載的安裝包] cd [解壓後的文件] ./configure ./configure --with-ssl (將ssl模塊打進去) make(這一步會有一點慢) make install 3. mv /usr/bin/python /usr/bin/python22 ln -s /usr/local/bin/python3 /usr/bin/python 4.頭部的python===>python22 vim /usr/bin/yum vim /usr/libexec/urlgrabber-ext-down =======下載===================================== pip: 1.下載: wget https://files.pythonhosted.org/packages/45/ae/8a0ad77defb7cc903f09e551d88b443304a9bd6e6f124e75c0fbbf6de8f7/pip-18.1.tar.gz 2.解壓,進入解壓目錄 python setup.py install 3.下載setuptools wget https://files.pythonhosted.org/packages/6e/9c/6a003320b00ef237f94aa74e4ad66c57a7618f6c79d67527136e2544b728/setuptools-40.4.3.zip 4.解壓,進入解壓目錄 python setup.py install 5.yum -y install zlib zlib-devel gcc openssl-devel 6.從新編譯安裝python, 進入python的解壓目錄 ./configure --with-ssl(將ssl模塊打進去) make make install 7.回到setuptools解壓目錄,python setup.py install 8.回到pip解壓目錄,python setup.py install 建議安裝virtualenv進行管理 https://blog.csdn.net/liuge36/article/details/81631901 仍是不行,參照https://blog.csdn.net/jeryjeryjery/article/details/77880227