CentOS 6.5-安裝Python 2.7.11
1、安裝python2.7.11
1.1、安裝原則:
在不影響預設系統自帶的python2.6.6的情況下安裝python2.7.11
1.2、安裝依賴包
shell>yum install -y gcc zlib-devel openssl openssl-devel python-devel readline-devel
1.3、下載python2.7.11
shell>cd /usr/srcshell>wget
1.4、安裝
將python2.7安裝到/usr/local目錄下
shell>tar zxvf Python-2.7.11.tgzshell>cd Python-2.7.11shell>./configure --prefix=/usr/local/python2.7shell>makeshell>make install
1.5、安裝後目錄結構
[root@localhost python2.7]# pwd/usr/local/python2.7[root@localhost python2.7]# lltotal 16drwxr-xr-x. 2 root root 4096 Feb 14 22:22 bindrwxr-xr-x. 3 root root 4096 Feb 14 22:22 includedrwxr-xr-x. 4 root root 4096 Feb 14 22:22 libdrwxr-xr-x. 3 root root 4096 Feb 14 22:22 share
2、安裝setuptools
shell>cd /usr/srcshell>wget zxvf setuptools-20.1.1.tar.gz shell>cd setuptools-20.1.1shell>/usr/local/python2.7/bin/python2.7 setup.py install
3、安裝pip
shell>cd /usr/srcshell>wget zxvf pip-8.0.2.tar.gzshell>cd pip-8.0.2shell>/usr/local/python2.7/bin/python2.7 setup.py install
4、安裝python包
shell>cd /usr/local/python2.7/binshell>./pip2.7 install yaml ua_parser user_agents
5、測試包安裝是否成功
[root@localhost bin]# pwd/usr/local/python2.7/bin[root@localhost bin]# /usr/local/python2.7/bin/pythonPython 2.7.11 (default, Feb 14 2016, 22:19:05) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import yaml>>> import ua_parser>>> import user_agents>>>
6、建立軟連線
將python2.7pip2.7放到環境變數目錄下。例如:/usr/bin/目錄,這樣在呼叫的餓時候就不用到python的安裝目錄下去執行,直接呼叫就可以。
shell>ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python2.7shell>ln -s /usr/local/python2.7/bin/pip2.7 /usr/bin/pip2.7
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/2730/viewspace-2802624/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS 安裝Python3CentOSPython
- centos 安裝python3.5.2CentOSPython
- Centos 安裝 MySQL-pythonCentOSMySqlPython
- CentOS 安裝 Python3CentOSPython
- centOS安裝python3CentOSPython
- CentOS Python 3.12安裝CentOSPython
- 為CentOS安裝python3CentOSPython
- CentOS6.5安裝python3.7CentOSPython
- CentOS 7.4 下安裝Python3.6CentOSPython
- CENTOS 6.5 安裝 Python 2.7 總結CentOSPython
- Centos8 安裝python3.8CentOSPython
- CentOS 全新編譯安裝 Python3.8CentOS編譯Python
- 如何在 CentOS 7 上安裝 Python 3CentOSPython
- centos7下安裝Python的pipCentOSPython
- CentOS7快速安裝python3CentOSPython
- centos7 python2 安裝pipCentOSPython
- VirtualBox CentOS 7安裝Python3CentOSPython
- CentOS探索之路3—安裝python3CentOSPython
- Centos6.5安裝python2.7.5+pipCentOSPython
- 在CentOS 6.5上安裝python2.7CentOSPython
- centos7.1安裝 python2.7.10CentOSPython
- centos7 安裝 python3.12CentOSPython
- CentOs8 安裝python3.11.9CentOSPython
- centos7下安裝Python3.7CentOSPython
- centos7安裝python3.11CentOSPython
- 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