简体   繁体   English

使用pyinstaller创建后无法运行python exe文件

[英]Cannot run python exe file after create with pyinstaller

So I have this python project that using argparse library to accept arguments .所以我有这个python项目,它使用argparse库来接受arguments When I run the project using the .py file using this command:当我使用此命令使用.py文件运行项目时:

python c:\projects\proj1\main.py --user blabla --password 12345678

All good.都好。

Now I create .exe file using pyinstaller and this commend:现在我使用pyinstaller创建.exe文件,这个命令:

py_installer_path\pyinstaller.exe --onefile c:\projects\proj1\main.py

And when I try to run it:当我尝试运行它时:

c:\main.exe --user blabla --password 12345678

I received this error:我收到此错误:

usage: main.exe [-h] -u USER -p PASSWORD
main.exe: error: the following arguments are required: -u/--user, -p/--password

EDIT编辑

Ok so the problem is with undetected_chromedriver :好的,问题出在undetected_chromedriver上:

File "undetected_chromedriver_ init _.py", line 388, in init init中的文件“undetected_chromedriver_ init _.py”,第 388 行
File "undetected_chromedriver\dprocess.py", line 37, in start_detached File "multiprocessing\connection.py", line 255, in recv File "multiprocessing\connection.py", line 310, in _recv_bytes文件“undetected_chromedriver\dprocess.py”,第 37 行,在 start_detached 文件“multiprocessing\connection.py”,第 255 行,在 recv 文件“multiprocessing\connection.py”,第 310 行,在 _recv_bytes

This module is install on my env and as i mentioned this works fine when I run the script using the .py file.这个模块安装在我的环境中,正如我提到的,当我使用env文件运行脚本时,它工作.py Any suggestions?有什么建议么?

It is extremely hard to debug when missing the main code.缺少主要代码时调试起来非常困难。 If it is sensitive code, just create a simple function that can work as a example.如果它是敏感代码,只需创建一个简单的 function 即可作为示例。 It might also help you debug if you narrow it down to a few lines of code.如果将其缩小到几行代码,它也可能有助于调试。

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

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