1

我正在看“ Learn Python The Hard Way ”教程,当它告诉我在安装后在 Powershell 中键入 Python 来尝试它时,它一直给我这个:

PS C:\Users\Zach> python
Traceback (most recent call last):
File "C:\Python27\lib\site.py", line 548, in <module>
main()
File "C:\Python27\lib\site.py", line 530, in main
known_paths = addusersitepackages(known_paths)
File "C:\Python27\lib\site.py", line 266, in addusersitepackages
user_site = getusersitepackages()
File "C:\Python27\lib\site.py", line 241, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "C:\Python27\lib\site.py", line 231, in getuserbase
USER_BASE = get_config_var('userbase')
File "C:\Python27\lib\sysconfig.py", line 516, in get_config_var
return get_config_vars().get(name)
File "C:\Python27\lib\sysconfig.py", line 449, in get_config_vars
import re
File "C:\Python27\lib\re.py", line 105, in <module>
import sre_compile
File "C:\Python27\lib\sre_compile.py", line 14, in <module>
import sre_parse
File "C:\Python27\lib\sre_parse.py", line 17, in <module>
from sre_constants import *
File "C:\Python27\lib\sre_constants.py", line 18, in <module>
from _sre import MAXREPEAT
ImportError: cannot import name MAXREPEAT

我也尝试通过命令提示符运行并得到相同的错误。我已经安装和卸载了大约 3 次 python,并且重新启动了几次无济于事。我对python很陌生,我对在这里做什么感到困惑。我也很感激任何指向其他 python 教程的链接。

4

1 回答 1

1

在这种情况下,据我了解,您没有名为“MAXREPEAT”的模块,或者您(或安装程序)将它安装在错误的地方。重新安装或重定向路径应该可以正常工作。

于 2013-10-06T22:17:12.553 回答