本文介绍了cxfreeze virtualenv内部缺少distutils模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 从python3.2项目运行cxfreeze二进制文件时,出现以下运行时错误:When running a cxfreeze binary from a python3.2 project I am getting the following runtime error:/project/dist/project/distutils/__init__.py:13: UserWarning: The virtualenv distutils package at %s appears to be in the same location as the system distutils?Traceback (most recent call last): File "/home/chrish/.virtualenvs/project/lib/python3.2/distutils/__init__.py", line 19, in <module> import distImportError: No module named dist的模块,相应地有几个 distutils 项:Correspondingly there are several distutils entries in the missing modules section of the cxfreeze output:? dist imported from distutils? distutils.ccompiler imported from numpy.distutils.ccompiler? distutils.cmd imported from setuptools.dist? distutils.command.build_ext imported from distutils? distutils.core imported from numpy.distutils.core...我已经尝试过通过将distutils导入我的主python文件并将其添加到cxfreeze setup.py as:I've tried forcing distutils to be included as a module, by both importing it in my main python file and by adding it to a cxfreeze setup.py as:options = {"build_exe": {"packages" : ["distutils"]} },这两种方法均无效。好像我已经以某种方式破坏了virtualenv [因为distutils看起来很基本,并且警告distutils的位置],并重复使用干净的virtualenv重复了这个问题。Neither approach worked. It seems likely that I've somehow broken the virtualenv [as distutils seems fundamental and the warning regarding the location of distutils], repeating with a clean virtualenv replicated the problem.可能值得注意的是,我通过运行 $ VIRTUAL_ENV / build / cx-freeze / setup.py install 来安装cx-freeze,因为它不能在pip中干净地安装。 / p>It may be worth noting that I installed cx-freeze by running $VIRTUAL_ENV/build/cx-freeze/setup.py install as it doesn't install cleanly in pip.推荐答案总结我的评论: distutils 正在做一些奇怪的事情,使cx_Freeze感到困惑。简单的解决方法是在virtualenv外部冻结,以便它使用distutils的系统副本。The copy of distutils in the virtualenv is doing some bizarre things which confuse cx_Freeze. The simple workaround is to freeze outside a virtualenv, so that it uses the system copy of distutils.在Ubuntu上,Python 2和3可以愉快地共存:只需使用 python3 使用Python 3做任何事情。在Python 3下安装cx_Freeze: python3 setup.py install 。On Ubuntu, Python 2 and 3 co-exist happily: just use python3 to do anything with Python 3. E.g. to install cx_Freeze under Python 3: python3 setup.py install. 这篇关于cxfreeze virtualenv内部缺少distutils模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-08 20:49