Cx_Freeze找不到pkg_resources /*.*' [英] Cx_Freeze cannot find pkg_resources/*.*'

查看:109
本文介绍了Cx_Freeze找不到pkg_resources /*.*'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过以下命令使用cx_Freeze setup.py文件构建EXE:

I'm trying to build an EXE using a cx_Freeze setup.py file with the following command:

python setup.py bdist_msi

命令的输出以以下结尾:

The command's output ends with:

正在从包pkg_resources复制数据...错误:[错误3]系统
找不到指定的路径:'C:\Program
Files\Anaconda2\ \lib\site-packagessetuptools-27.2.0-py2.7.egg\pkg_resources /*.*'

Copying data from package pkg_resources... error: [Error 3] The system cannot find the path specified: 'C:\Program Files\Anaconda2\lib\site-packages\setuptools-27.2.0-py2.7.egg\pkg_resources/*.*'

我不确定该怎么做。我检查了一下,发现setuptools的鸡蛋存在,并且在其中有一个pgk_resources库,我不确定该怎么办。

I'm not sure what to make of it. I've checked and the setuptools' egg exists, and inside it there is a pgk_resources library, and I'm not sure what to do.

我正在使用conda安装和python2.7。

I'm using a conda installation and python2.7.

任何帮助将不胜感激。

推荐答案

这是因为 cx_Freeze 无法与打包为 .egg s安装的软件包的子软件包一起使用。普通的Python安装使用 pip 总是解压缩 .egg s,与Anaconda不同。

That's because cx_Freeze cannot work with subpackages of packages installed as packed .eggs. A normal Python installation uses pip which always unpacks .eggs, unlike Anaconda.

相应的问题:无法在压缩鸡蛋的子包装中找到模块·第120期·anthony-tuininga / cx_Freeze 。它链接到修复请求

The corresponding issue: Failed to find module in subpackage in zipped egg · Issue #120 · anthony-tuininga/cx_Freeze. It links to the pull request with the fix:

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

Replacing all the .eggs you have with unpacked versions with pip install --upgrade as suggested in the other answer is only a temporary solution - until you get another .egg.

这篇关于Cx_Freeze找不到pkg_resources /*.*'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆