我正在尝试用cx_freeze和esky构建一个应用程序。它以前起作用了(好吧,也许几个月前)。从那以后,python3.5就熄灭了)。
我有以下例外:
File "/usr/lib/python3.5/site-packages/esky/util.py", line 578, in compile_to_bytecode
loader = importlib._bootstrap.SourceLoader()
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceLoader'我在用:
我用的是Manjaro (Linux)。我不知道问题是从哪里来的。能帮我一下吗?
发布于 2015-10-27 10:49:01
mmm那里可能有一个bug在查看源代码:
if sys.version_info[:2] < (3, 1):
bytecode = imp.get_magic() + struct.pack("<i", 0)
bytecode += marshal.dumps(compile(source_code, compile_filename, "exec"))
elif sys.version_info[:2] < (3, 4):
bytecode = imp.get_magic() + struct.pack("<ii", 0, 0)
bytecode += marshal.dumps(compile(source_code, compile_filename, "exec"))
else:
loader = importlib._bootstrap.SourceLoader()
code = loader.source_to_code(source_code, '<string>')
bytecode = importlib._bootstrap._code_to_bytecode(code, mtime=0, source_size=0)你能试着用以下文字代替这一行吗?
loader = importlib._bootstrap_external.SourceLoader()
如果这样做有效,那么尝试使用小于3.5的版本,并在他们的github问题页面中提交一个bug。
发布于 2019-11-07 17:28:37
我能够通过运行以下命令来解决这个问题:
pip3 uninstall setuptools
pip3 install setuptools发布于 2017-07-11 20:19:17
我今天遇到了同样的问题。
在终端中运行以下命令解决了我的问题。
➜ ~ pip install --upgrade pip
➜ ~ pip install --upgrade virtualenvwrapper
➜ ~ mkvirtualenv -p /usr/local/bin/python3 test_envhttps://stackoverflow.com/questions/33365471
复制相似问题