Python:需要帮助关于运行它

问题描述 投票:1回答:1

每当我在我的窗口shell上运行它:

 PS C:\python27\scripts> python pyinstaller-script.py --onefile --noconsole .F "C:\Users\Win\Desktop\Radium-Keylogger-master\Radium-Keylogger-master\rubi.py"

我在下面收到此错误消息

C:\ Python27 \ python.exe:无法打开文件'pyinstaller-script.py':[Errno 2]没有这样的文件或目录

pypy
1个回答
1
投票

命令中的'python'调用python.exe可执行文件,该文件将执行脚本'pyinstaller-script.py'中的python代码

如果你没有在你的路径中添加'python'(在环境变量中),那么你必须实际上在python可执行文件的位置来运行它,或者通过指定路径来调用它,例如> \ PATH \ TO \ PYTHON \ python.exe my_script.py --myargs

从您的注释中看起来,您在环境变量中设置了python 3的路径,因为即使您位于python27位置,也会在检查版本时获得python3的实例。

所以,如果你需要用python 2而不是python3运行pyinstaller-script.py,那么可以试试'python.exe'而不是python(这只是一个系统变量,目前正在寻找python 3 exe)

但我个人认为这不是你的错误问题

C:\Python27\python.exe: can't open file 'pyinstaller-script.py': [Errno 2] No such file or directory

我认为你的问题是你不在pyinstaller-script.py的目录中,并且因为python默认在当前目录中查找该脚本,所以它找不到它,所以你需要指定一个路径到那里文件位于:

如果你应该用python 3运行它

C:\ANYWHERE> python C:\PATH\TO\pyinstaller-script.py --onefile --noconsole .F "C:\Users\Win\Desktop\Radium-Keylogger-master\Radium-Keylogger-master\rubi.py"

如果你应该用python 2运行它

C:\python27> python.exe C:\PATH\TO\pyinstaller-script.py --onefile --noconsole .F "C:\Users\Win\Desktop\Radium-Keylogger-master\Radium-Keylogger-master\rubi.py"

注意 - 重要的补充是C:\PATH\TO\

© www.soinside.com 2019 - 2024. All rights reserved.