centos 安裝python3.5.2
雖然,這個並不難,但因為對linux不熟悉,公司電腦又限制了部分資源的下載,走了許多彎路。此文經驗證是可用的。
本文以安裝python3.5.2為例子
1、從Python官網下載
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz
2、解壓Python-3.5.2.tgz
tar xzf Python-3.5.2.tgz
3、配置編譯安裝python3
安裝python需要的庫:
yum -y install gcc gcc-c++ openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
cd Python-3.5.2/
進行配置,把安裝的python3.5.2的目錄放到/usr/local/python3.5裡面
./configure --prefix=/usr/local/python3
完成後執行echo $?返回是0則配置沒有錯誤,繼續進行下一步編譯
make -j2
完成後執行echo $?返回是0則編譯沒有錯誤,繼續進行下一步安裝
make install -j2
ls /usr/local/python3/bin/python3.5
看到有這個檔案,則用軟連結的形式新增到變數裡面
ln -s /usr/local/python3/bin/python3.5 /usr/bin/python3
ls /usr/local/python3/bin/pip3
這裡會出現兩種情況,如果有這個檔案,則直接到(2):
(1)如果提示沒有這個檔案,則需要把pip3編譯安裝上去
tar xzf pip-8.1.2.tar.gz
cd pip-8.1.2/
python2 setup.py install
如果出現以下提示:
Traceback (mostrecent call last):
File "setup.py", line 6, in<module>
from setuptools import setup, find_packages
ImportError: Nomodule named setuptools
則需要先安裝setuptools,再安裝pip
tar xzf setuptools-25.2.0.tar.gz
cd setuptools-25.2.0/
python3 setup.py install
最後提示Finished processing dependencies forsetuptools==25.2.0
則安裝setuptools成功
再回去pip-8.1.2目錄
執行python3 setup.py install安裝
最後提示Finished processing dependencies for pip==8.1.2
則pip安裝成功
ls檢視確認
ls /usr/local/python3/bin/pip3
(2)提示有這個檔案,則用軟連結的形式新增到變數裡面
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
4、驗證安裝
輸入python3命令,出現以下則成功
Python 3.5.2(default, Aug 31 2016, 07:34:34)
[GCC 4.8.5 20150623(Red Hat 4.8.5-4)] on Linux
Type"help", "copyright", "credits" or"license" for more information.
>>>
輸入pip3 -V命令,出現以下則成功
pip 8.1.1 from /usr/local/python3/lib/python3.5/site-packages (python 3.5)
相關文章
- CentOS 6.5安裝Oracle 11.2.0.4------CentOS 6.5安裝CentOSOracle
- CentOS安裝jdkCentOSJDK
- CentOS安裝gitCentOSGit
- Centos 安裝RedisCentOSRedis
- CentOS 安裝 mavenCentOSMaven
- CentOS Docker 安裝CentOSDocker
- centOS安裝rabbitMQCentOSMQ
- CentOS 安裝 dockerCentOSDocker
- CentOS安裝pipCentOS
- Centos安裝opensslCentOS
- CentOS 安裝ScrapyCentOS
- CentOS 安裝ErlangCentOS
- CentOS安裝GraphicsMagickCentOS
- CentOS 安裝 JDKCentOSJDK
- Centos安裝rubyCentOS
- CentOS安裝DockerCentOSDocker
- CentOS 安裝PHPCentOSPHP
- CentOS安裝MySQLCentOSMySql
- centos 安裝swftoolsCentOS
- mongo centos 安裝GoCentOS
- CentOS 安裝 VNCCentOSVNC
- centos安裝mongodbCentOSMongoDB
- CentOS 安裝 SubversionCentOS
- CentOS安裝proftpdCentOSFTP
- centos安裝nodeCentOS
- centos 安裝pyenvCentOS
- Centos 安裝yum,安裝ansibleCentOS
- 【CentOS】CentOS7安裝PostgreSQLCentOSSQL
- Centos Docker安裝、升級、解除安裝CentOSDocker
- Centos7安裝安裝部署dockerCentOSDocker
- Centos7.9安裝解除安裝DockerCentOSDocker
- centos下安裝dockerCentOSDocker
- Centos 7安裝iscsiCentOS
- CentOS 上安裝 NginxCentOSNginx
- Jenkins CentOS 安裝JenkinsCentOS
- centos上安裝grafanaCentOSGrafana
- Centos 安裝 JenkinsCentOSJenkins
- CentOS redis安裝配置CentOSRedis