How to convert selenium python file to exe? - python

I am trying to convert python file to exe file. I've used pyinstaller.
Steps I followed:
I opened the cmd in the folder where is my script
I used the next command: pyinstaller --onefile -w name.py
And I got the below error when I want to open exe. I want to mention that I use selenium to open a Chrome Browser so chromedriver.exe is needed

Related

I can't convert pygame to exe

I made an app for my friends but I can't make executable file. I tried to use pyinstaler and cx_Freeze but it didn't worked. It creates properly an exe file but It doesn't work. When I try to run executable It pops out empty cmd window and disapears without any error.
Im working on python 3.7.4.
There is code that I used to create exe with cx Freeze:
import cx_Freeze
executables = [cx_Freeze.Executable("GenshinHelper.py")]
cx_Freeze.setup(
name="GenshinHelper",
options={"build_exe": {"packages":["pygame",'datetime'],
"include_files":['img1.jpg','img2.jpg']}},
executables = executables
)
Here is one way t do that;
first install pyinstaller;
pip install pyinstaller
then write this command;
pyinstaller --onefile -w your_file.py
--onefile will convert all the files in your project into a single file.
-w: command prompt (console) will not pop-up when you will run this .exe file. If your app is a console app, then remove -w.
This will convert your file into an .exe file and will run on any other computer without python installed.
More info at https://youtu.be/UZX5kH72Yx4.

Im trying to turn a python file into an exe file and its not working

I tried making my python file into an exe using pyinstaller main.py --onefile --noconsole
.I was getting an error when I tried opening the exe from dist so i used --debug=all and it said pyinstaller: error: the following arguments are required: scriptname.
What exactly do i do im not too sure as its my first time.
To convert a python file to exe:
Make sure you have pyinstaller installed and up to date
pip install pyinstaller
in PowerShell type the following:
pyinstaller --onefile -w 'youfilename.py'
The file name should come out as 1.exe
Make sure are in the right directory
If you have more doubts use this link: https://www.geeksforgeeks.org/convert-python-script-to-exe-file/

Unable to open .exe file

I wrote a python script for a calculator and tried to convert my .py file to a .exe file. After converting to .exe file, I am getting error("Failed to execute script <Filename>").
The solutions i have tried:
I tried to run my python3.8 script using 3.6 script.
I tried converting my .png icon to .ico image.
I tried to convert my .py file .exe file using pyinstaller & auto-py-to-exe as well.

.py to .exe with icon , images and chromedriver

I have a GUI program which has icons and some images and chromedriver.
Now I want to convert the .py file to .exe with having icon, images and the chromedriver inside the exe. How can I achieve this?
I have tried pyinstaller and that works but I have to keep the icons and chromedriver inside the folder where the exe is and then only it would work but I want it to be inside the exe where i can just distribute the exe to my friend without the chromedriver.
Try this
pyinstaller --onefile --windowed --icon=app.ico test.py
Also, add chrome driver in test.spec file,
binaries=[('path\chromedriver.exe', '.')]
Update the spec file, like pyinstaller test.spec.
You can also update the app icon via the spec file.icon='app.ico'

How to convert python script to exe Without additional files

I want to convert my python script to exe without additional files like ddl, pyd..
Is it possible?
Use pyinstaller https://github.com/pyinstaller/pyinstaller
Install it by running pip install pyinstaller in terminal / console
Then run pyinstaller --onefile yourscriptsname.py and it will create you an exe file in the same directory

Categories