国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python2.6.6如何升級到python2.7.14

2020-02-22 23:37:30
字體:
來源:轉載
供稿:網友

其實網上有很多關于python2.6.6 升級到python2.7的文章,但是我對比這些類似的文章升級之后,發現其中有錯誤的地方,于是決定還是自己寫一個真正的升級過程。

我的虛擬機里安裝的是CentOS 6.5里面默認安裝的Python2.6.6,因為要學習TensorFlow,所以決定升級到2.7

1、下載安裝包

其實在python官網上有個目錄列舉出了各個版本的下載安裝包,點擊這里,可以看到

這里是按照發布時間排列的,往下拉可以找到已經發布的各個版本,我們找到2.7.14,這個是比較重要的一個版本

點擊這里的Python-2.7.14.tgz可以直接下載安裝包文件,也可以使用wget來直接下載,如果需要安裝的服務器無法直接訪問外網,可以使用下載安裝包文件的方式,如果可以訪問外部推薦使用wget方式。

wget https://www.python.org/ftp/python/Python-2.7.14.tgz

無論用哪種方式,下載到安裝包之后都會得到Python-2.7.14.tgz這個安裝文件

2、解壓配置

解壓安裝文件

tar -zvf Python-2.7.14.tgz  

得到 Python-2.7.14文件夾

cd Python-2.7.14

./configure --prefix=/usr/local/python2.7

執行之后提示是這樣

[root@node2 Python-2.7.14]# ./configure --prefix=/usr/local/python2.7 checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking for python2.7... no checking for python3... no checking for python... python checking for --enable-universalsdk... no checking for --with-universal-archs... 32-bit checking MACHDEP... linux2 checking EXTRAPLATDIR... checking for --without-gcc... no checking for --with-icc... no checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in `/opt/package/python_lib/Python-2.7.14': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details 

提示:no acceptable C compiler found in $PATH

于是趕緊測試下gcc果然這個不存在,可能是虛擬機在安裝CentsOS時沒有選擇安裝GCC

[root@node2 Python-2.7.14]# gcc -bash: gcc: command not found [root@node2 Python-2.7.14]# yum -y install gcc 

執行yum -y install gcc安裝了gcc ,重新執行./configure --prefix=/usr/local/python2.7可以正常安裝python

執行make

執行make install

然后進入/usr/local/python2.7/bin,這個目錄的內容如下:

[root@node2 bin]# ll 總用量 6164 -rwxr-xr-x. 1 root root 111 11月 9 19:24 2to3 -rwxr-xr-x. 1 root root 109 11月 9 19:24 idle -rwxr-xr-x. 1 root root 94 11月 9 19:24 pydoc lrwxrwxrwx. 1 root root 7 11月 9 19:27 python -> python2 lrwxrwxrwx. 1 root root 9 11月 9 19:27 python2 -> python2.7 -rwxr-xr-x. 1 root root 6273995 11月 9 19:24 python2.7 -rwxr-xr-x. 1 root root 1697 11月 9 19:27 python2.7-config lrwxrwxrwx. 1 root root 16 11月 9 19:27 python2-config -> python2.7-config lrwxrwxrwx. 1 root root 14 11月 9 19:27 python-config -> python2-config -rwxr-xr-x. 1 root root 18557 11月 9 19:24 smtpd.py [root@node2 bin]#             
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 台前县| 辽宁省| 遂溪县| 滨海县| 沂源县| 麦盖提县| 自治县| 灵石县| 蒙阴县| 黄龙县| 茌平县| 监利县| 安陆市| 盘山县| 托里县| 盈江县| 崇阳县| 固原市| 合山市| 灵石县| 诏安县| 锡林浩特市| 宁乡县| 茌平县| 北碚区| 资中县| 灌阳县| 二连浩特市| 翼城县| 岢岚县| 波密县| 佛冈县| 洛宁县| 大城县| 平阳县| 东兰县| 南漳县| 义马市| 酒泉市| 和硕县| 和硕县|