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 Python 3.12安裝CentOSPython
- CentOS 安裝Python3CentOSPython
- centOS安裝python3CentOSPython
- 為CentOS安裝python3CentOSPython
- CentOS6.5安裝python3.7CentOSPython
- CentOS 7.4 下安裝Python3.6CentOSPython
- CentOs8 安裝python3.11.9CentOSPython
- centos7安裝python3.11CentOSPython
- centos7 安裝 python3.12CentOSPython
- Centos8 安裝python3.8CentOSPython
- 如何在 CentOS 7 上安裝 Python 3CentOSPython
- centos7安裝python3.12.3(最新)CentOSPython
- CentOS 全新編譯安裝 Python3.8CentOS編譯Python
- CentOS7快速安裝python3CentOSPython
- centos7下安裝Python3.7CentOSPython
- CentOS探索之路3—安裝python3CentOSPython
- centos7下安裝Python的pipCentOSPython
- centos7 python2 安裝pipCentOSPython
- Centos下安裝Python3.6和Python2共存CentOSPython
- Linux(CentOS7)安裝最新版PythonLinuxCentOSPython
- Centos 安裝 python3.x 為預設CentOSPython
- centos7編譯安裝python3CentOS編譯Python
- CentOS下編譯安裝Python3教程CentOS編譯Python
- CentOS 7下編譯安裝Python3CentOS編譯Python
- CentOS 7 如何編碼安裝Python3?CentOSPython
- CentOS 安裝 JDKCentOSJDK
- CentOS安裝GraphicsMagickCentOS
- Centos 安裝RedisCentOSRedis
- CentOS 安裝 mavenCentOSMaven
- Jenkins CentOS 安裝JenkinsCentOS
- centos 安裝pyenvCentOS
- CentOS 安裝ErlangCentOS
- centos安裝nodeCentOS
- Centos 安裝 JenkinsCentOSJenkins
- centOS安裝rabbitMQCentOSMQ
- CentOS安裝gitCentOSGit
- CentOS Docker 安裝CentOSDocker
- CentOS安裝jdkCentOSJDK