我正在尝试使用 cx_Freeze setup.py 文件和以下命令构建 EXE:
python setup.py bdist_msi
该命令的输出以以下内容结尾:
正在从包 pkg_resources 复制数据...错误:[错误 3] 系统
找不到指定的路径:'C:\Program
文件\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\pkg_resources/*.*'
我不知道该怎么办。我检查过 setuptools 的 Egg 存在,里面有一个 pgk_resources 库,我不知道该怎么做。
我正在使用 conda 安装和 python2.7。
任何帮助将不胜感激。
那是因为cx_Freeze
无法使用打包安装的软件包的子包.egg
s。正常的 Python 安装使用pip
总是打开包装.egg
s,与 Anaconda 不同。
对应问题:无法在压缩的 Egg 子包中找到模块 · 问题 #120 · anthony-tuininga/cx_Freeze https://github.com/anthony-tuininga/cx_Freeze/issues/120。它链接到拉取请求 https://bitbucket.org/anthony_tuininga/cx_freeze/pull-requests/90/finder-can-now-deal-mixed-slashes-paths/diff修复后:
diff --git a/cx_Freeze/finder.py b/cx_Freeze/finder.py
--- a/cx_Freeze/finder.py
+++ b/cx_Freeze/finder.py
@@ -61,6 +61,15 @@
If the module is found, this returns information in the same format
as :func:`imp.find_module`. Otherwise, it returns None.
"""
+ # FIX: retrieve_loadable_module dict uses paths with OS's separator
+ # as keys. However the path received as argument can have mixed
+ # slashes. This may cause some searches to fail when they should
+ # work. One case where this seems critical is when there are
+ # subpackages inside an egg package.
+ #
+ # See `record_loadable_module` method to see how mixed slashes
+ # happen.
+ path = os.path.normpath(path)
try:
return self.retrieve_loadable_module(path, modulename)
except KeyError:
更换所有.egg
s 你有解压版本pip install --upgrade
正如另一个答案中所建议的那样,这只是一个临时解决方案 - 直到您得到另一个答案.egg
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)