我已经下载了Python3.3, 解压后执行了
./configure
, make
和make altinstall
。当我执行python3.3
时,出现以下错误信息:
我检查了Python环境变量,它们似乎都正常。在我的Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted
.profile
文件中插入了以下行:export PYTHONHOME=/usr/local/lib/python3.3/:/usr/local/lib/python3.3/lib/:/usr/local/lib/python3.3/lib/site-packages/
export PYTHONPATH=/usr/local/bin/
export PATH=$PYTHONPATH:$PATH
我随后执行了source .profile
,但Python无法启动。
在安装了pydev
后,我尝试从/usr/local/bin添加Python解释器时,在Eclipse中收到以下消息:
No output was in the standard output when trying to create the interpreter info.
The error output contains:>>Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Traceback (most recent call last):
File "/home/sabya/eclipse/plugins/org.python.pydev_2.7.3.2013031601/pysrc/interpreterInfo.py", line 52, in <module>
import time
ImportError: No module named 'time'
我不知道还需要设置什么,才能让Python正常工作。我正在运行OpenSuSE 12.3。
PYTHONHOME
和PYTHONPATH
搞混了? - Thomas FenzlPYTHONPATH
是模块搜索路径,请参阅文档。PYTHONHOME
用于标准库,同样在文档中有解释。假设您已经在/usr/local
下安装了 python3,请将其作为PYTHONHOME
尝试。 - Thomas Fenzl