导入错误:无法导入名称别名
我刚在Windows Vista上安装了Python 2.7.1,使用的是官方网站的安装程序,但在运行python.exe时遇到了这样的错误。
C:\Python27>python.exe
Traceback (most recent call last):
File "C:\Python27\Lib\site.py", line 553, in <module>
main()
File "C:\Python27\Lib\site.py", line 542, in main
aliasmbcs()
File "C:\Python27\Lib\site.py", line 467, in aliasmbcs
import locale, codecs
File "C:\Python27\Lib\locale.py", line 15, in <module>
import encodings
File "C:\Python27\Lib\encodings\__init__.py", line 32, in <module>
from encodings import aliases
ImportError: cannot import name aliases
我还刚安装了Python 3.1.3。
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
File "C:\Python31\lib\encodings\__init__.py", line 32, in <module>
ImportError: cannot import name aliases
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
这是怎么回事呢?我需要配置PYTHONPATH或者类似的东西吗?如果需要的话,它应该设置成什么值呢?
1 个回答
3
我找到的唯一参考资料提到的是一个病毒问题:
开始于这里: http://mail.python.org/pipermail/tutor/2009-January/066730.html,接着是: http://mail.python.org/pipermail/tutor/2009-January/066739.html,最后是: http://mail.python.org/pipermail/tutor/2009-January/066750.html
如果你的 \Lib\encodings\aliases.py
文件不见了,而且你也无法在那个地方创建一个同名的文件,那就要开始检查一下是不是中了木马病毒。