执行 py2exe 失败,并显示无法打开文件“setup.py”;
我正在使用 py2exe,但在命令提示符中出现以下错误。
C:\Users\Me>C:\Python26\My_scripts\python.exe setup.py py2exe
C:\Python26\My_scripts\python.exe: can't open file 'setup.py': [Errno 2] No such
file or directory
我做错了什么?
I'm using py2exe and I get the following errors in command prompt.
C:\Users\Me>C:\Python26\My_scripts\python.exe setup.py py2exe
C:\Python26\My_scripts\python.exe: can't open file 'setup.py': [Errno 2] No such
file or directory
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于您的评论证实了我的预期,我将跟进回复帖子。
您从调用可执行文件时所在的目录调用了 python。在这种情况下,根据您的提示,您从
C:\Users\Me
调用它。因此,python 尝试在此目录下查找 setup.py(该目录不存在)。您可以:1) 将目录更改为 setup.py 文件的位置,然后调用 python。如果 python 可执行文件不在您的 PATH 中或位于不同的目录中,则需要它的完整路径,否则就不是:
2) 将 python 指向
setup.py
的绝对路径:Since your comment confirmed what I expected, I'll follow up with an answer post.
You invoked python from the directory you were in when you called the executable. In this case, according to your prompt, you invoked it from
C:\Users\Me
. Therefore, python is trying to findsetup.py
under this directory (which doesn't exist). You can either:1) Change directories to the location of the
setup.py
file, then invoke python. The full path to the python executable will be necessary if it's not in your PATH or if it's in a different directory, otherwise it is not:2) Point python to the absolute path of
setup.py
:C:\Users\Me
目录中没有名为setup.py
的文件。您可能会犯各种可能的错误,其中最有可能的是两个:settup.py
,哎呀,需要一个的地方有两个 T ) -- 然后,重命名该文件!cd
到该目录并重试!当然,两个错误可能同时发生(在这种情况下,您需要修复这两个错误)。
如果您认为您没有犯任何错误,请向我们展示
dir *.py
(来自Me
)目录...You have no file called
setup.py
in theC:\Users\Me
directory. Various possible mistakes you could be making, of which the two likeliest ones:settup.py
, oops, two Ts where one was needed) -- then, rename the file!cd
to that directory and try again!Of course, both errors might be happening at the same time (in which case you need to fix both).
If you think you made neither mistake show us a
dir *.py
(from theMe
) directory...