运行py2exe表示runpy3.4win32.exe丢失

2024-10-16 20:47:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图跟着this tutorial走,结果被卡住了。以下是我遵循的步骤:

  1. 我安装了32位的Python
  2. 我执行了conda create -n test py2exe -c sasview,它安装了python3.4.5-0、py2exe0.9.2.2-py34_1和其他包
  3. 我创建了包含print("Hello World!")hello.py文件
  4. 我创建了setup.py文件,其中包含:

    from distutils.core import setup import py2exe setup(console=['hello.py'])

  5. 我执行了

    activate test python setup.py py2exe

结果是:

running py2exe

  1 missing Modules
  ------------------
? readline                            imported from cmd, code, pdb
Building 'dist\hello.exe'.
error: [Errno 2] No such file or directory: 'C:\\Anaconda3\\envs\\test\\lib\\site-packages\\py2exe\\run-py3.4-win32.exe'

丢失的模块只是一个警告,可以忽略(参见here)。在

Py2exe还不适用于python3.5,而且conda似乎知道它并安装了python3.4。在

我错过了什么?在


Tags: 文件frompytestimporthellocreatesetup
1条回答
网友
1楼 · 发布于 2024-10-16 20:47:40

执行conda create -n test py2exe -c silg2将安装pytnon3.4.5而不是最新的3.5.2,这使我认为conda知道哪个版本可以与py2exe一起工作。显然这不是真的。在

这是有效的:

conda create -n test python=3.4
activate test
pip install py2exe
python setup.py py2exe

使用conda list显示两个环境中具有相同版本的相同包,但py2exe仅在由pip安装时有效,而在conda安装时则不起作用。在

相关问题 更多 >