简体   繁体   English

您可以更改 pyinstaller 认为 python.exe 所在的路径吗?

[英]Can you change the path pyinstaller thinks python.exe is in?

I want to use pyinstaller to make standalone exe files.我想使用 pyinstaller 来制作独立的 exe 文件。 I used我用了

pip install pyinstaller

first, then I got an error message I will show you in a second, so I used首先,然后我收到一条错误消息,我稍后会告诉你,所以我使用了

pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

because I found it on a pyinstaller website.因为我在pyinstaller网站上找到了它。 So I cd into the folder my script is in, and I think you don't need a setup.py file or anything for pyinstaller like you would need using py2exe , then I use the command所以我cd进入我的脚本所在的文件夹,我认为你不需要setup.py文件或任何pyinstaller文件,就像你需要使用py2exe一样,然后我使用命令

pyinstaller file.py --onefile

and I get the error message (I am translating the last part so it is not 100% accurate)我收到错误消息(我正在翻译最后一部分,所以它不是 100% 准确的)

Fatal error in launcher: Unable to create process using '"c:\python\python.exe" "C:\Python\Scripts\pyinstaller.exe" gtaReminder.py --onefile': System could not find the specified file.启动器中的致命错误:无法使用“c:\python\python.exe”“C:\Python\Scripts\pyinstaller.exe”gtaReminder.py --onefile' 创建进程:系统找不到指定的文件。

I think pyinstaller thinks that python.exe is located in c:\python\python.exe as it says in the error message.我认为pyinstaller认为python.exe位于c:\python\python.exe中,如错误消息中所述。 I just opened the path and it is not.我刚刚打开了路径,但事实并非如此。 Can I somehow change this path pyinstaller thinks it can find python.exe in?我可以以某种方式更改此路径 pyinstaller 认为它可以在其中找到python.exe吗? I am using python 3.6.2 , pip 20.3.3 on windows 10.我在 windows 10 上使用python 3.6.2pip 20.3.3

Firstly, your command line syntax is wrong, it is always supposed to be optional arguments followed by the mandatory arguments, below is the general syntax首先,你的命令行语法是错误的,它总是应该是可选的 arguments 后跟强制的 arguments,下面是一般语法

pyinstaller [options] script [script …] | pyinstaller [选项] 脚本 [脚本 ...] | specfile规格文件

Read the documentation here .此处阅读文档。

The correct command should be正确的命令应该是

pyinstaller --onefile file.py

The error does not suggest that pyinstaller has got the wrong python file, the fact that it could tell该错误并不表明pyinstaller得到了错误的 python 文件,事实上它可以告诉

Unable to create process using '"c:\python\python.exe" "C:\Python\Scripts\pyinstaller.exe"无法使用 '"c:\python\python.exe" "C:\Python\Scripts\pyinstaller.exe" 创建进程

means that it was able to find the python file and tried initiating the process but failed to perform the task altogether.意味着它能够找到 python 文件并尝试启动该过程但完全未能执行任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM