python3.0 在linux centerOS 5.2上的編譯安裝
阿新 • • 發佈:2018-12-23
2008-12-18
周海漢/文 ablozhou at gmail.com http://blog.csdn.net/ablo_zhou
首先,到www.python.org去下載最新的3.0版:
wget http://www.python.org/ftp/python/3.0/Python-3.0.tgz
大小11M
tar zxvf Python-3.0.tgz
解壓後執行
$./configure
通過
$make
出這麼一個錯誤: make: *** [sharedmods] 錯誤 1
查詢網上說是locale的問題:
"Python fails silently on bad locale" bug: http://bugs.python.org/issue2173 $locale LANG=zh_CN.UTF-8 LC_COLLATE="zh_CN.GB2312" LC_CTYPE="zh_CN.GB2312" LC_MESSAGES="zh_CN.GB2312" LC_MONETARY="zh_CN.GB2312" LC_NUMERIC="zh_CN.GB2312" LC_TIME="zh_CN.GB2312" LC_ALL=zh_CN.GB2312
是LC_CTYPE的值zh_CN.GB2312不是對Python合法的值,
$ export LC_ALL=zh_CN.UTF-8
$ locale
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_ALL=zh_CN.UTF-8
$make
總體成功了,但出如下的錯誤:
Failed to find the necessary bits to build these modules: _tkinter To find the necessary bits, look in setup.py in detect_modules() for the module's name.
這是圖形庫,可以不管。
$make install
....
* Note: not installed as 'python'.
* Use 'make fullinstall' to install as 'python'.
* However, 'make fullinstall' is discouraged,
* as it will clobber your Python 2.x installation.
安裝成功,但沒有替換原來的2.x的版本。如果想替換,可以執行”make fullinstall”
執行:
$ python3.0 Python 3.0 (r30:67503, Dec 18 2008, 16:31:33) [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>
如非註明轉載, 均為原創. 本站遵循知識共享CC協議,轉載請註明來源