I wrote a simple code in python/pygame, and the game was running fine in both sublime text and cmd, but when I tried to make it a exe file pyinstaller --onefile version2.py, I got an error and I don't know what is the problem ?
Well bro, I don't know if I will be helpfull to you know after 6 days, I am having 2 solutions for you which worked for me today.
Disable Antivirus OR put that folder in which you are building app.exe to Exception, like I have done below [Mandatory Process].
Dont' run pyinstaller command from the directory where app.py application is present.
a) Get out from that directory/folder
b) Create new directory/folder
c) Enter that directory and start cmd in that directory/folder by pressing (shift + MouseRightClick )
d) And then run the command
pyinstaller --name "MyApp" "python script file path of which you want to create .exe file"
Where "MyApp" is the name which you want to give to the file after it is build successfully
For Example
pyinstaller --name "FileRenamer" "G:\data\python\Project\Bunch File Renamer\rename.py"
Try to disable the anti-virus, that worked for me
Related
I have been able to freeze a Python/PySide2 script with fbs on macOS, and the app seems to work.
However, I got some errors from the freeze process stating:
Can not find path ./libshiboken2.abi3.5.13.dylib.
Does anyone know how to fix that?
Try to use the --runtime-tmpdir because while running the generated exe file it needs this file libshiboken2.abi3.5.13.dylib and unable hook that file.
Solution: use --add-data & --runtime-tmpdir to pyinstaller command line.
pyinstaller -F --add-data "path/libshiboken2.abi3.5.13.dylib":"**PATH"
--runtime-tmpdir temp_dir_name your_program.py
here PATH = the directory name of that file looking for.-F = one file
I use windows 10 and python2.7.
I have use PyInstaller to pack a program into exe. But I can not run the .exe file.
error:
raise FileNotFoundError('Tcl data directory "%s" not found.' % (tcldir))
IOError: Tcl data directory "C:\Users\test\AppData\Local\Temp\_MEI10~1\tcl" not
found.
[4072] Failed to execute script pyi_rth__tkinter
That's python error which means your program is running.
Check your code to see why it does not find the file you are mentioning.
Note: If you use relative paths consider that it matters where the .exe file is executed.
This is the process home directory.
You should use the following command:
pyinstaller main.py --add-data 'tcl;./tcl' #linux separator use 'tcl:./tcl'
Note: left 'tcl' is in the main.py's directory, right 'tcl' is target directory which is exe genrated directory. if right 'tcl' not existing will be created!
I encountered such a weird situation:
naivechou#naivechou/~>python test.py
test
naivechou#naivechou/~>pwd
/home/naivechou
naivechou#naivechou/~>python /home/naivechou/test.py
C:\toolchain\python\python.exe: can't open file '/home/naivechou/test.py': [Errno 2] No such file or directory
My working directory is /home/naivechou/, test.py is in there.
If I run test.py with absolute path, I'll get an error message of No such file or directory.But everything will be fine if I enter that directory and then run it. What's wrong with python?
Try moving into the folder where the python script is located and do a "ls" command there in Linux. if windows then do 'dir'. if you see the required file there then execute the following command
C:\location_where_the_script_is> python yourfile.py
For commands entered on the command line, Windows doesn't recognize forward-slashes as directory separators.
Your second example is looking in the current directory for the literal filename /home/naivechou/test.py, and of course such a filename does not exist.
Use backslashes instead, as is the Windows way:
python \home\naivechou\test.py
Hello everybody.
I have a small python project and want to make it to single executable file. I am using...
Windows 7
Python 3.4
PyInstaller 3.2.1
My PyInstaller command is,
PyInstaller -y -w -F -n output_file_name --uac-admin --clean source_file.py
this command works properly. But single output file does not ask for admin rights when executed. And there's no shield mark on executable file icon.
When remove the -F option (equivalent to --onefile), output executable file has shield mark on its icon and ask me admin rights. But this is not what I want. I want a single executable file.
I found a manifest file (output_file_name.exe.manifest) in dist\output_file_name folder. So I did...
PyInstaller -y -w -F -n output_file_name --manifest output_file_name.exe.manifest --uac-admin --clean source_file.py
But this command doesn't work. Its single executable file still does not ask for admin rights.
I have removed PyInstaller and installed recent development version.
pip install git+https://github.com/pyinstaller/pyinstaller.git#develop
But the result is same. Its output doesn't have a shield mark on icon and does not ask admin rights.
Do you have any idea?
Please help me!
I found what's wrong!
The key point is...
Install PyInstaller 3.0
Manifest file must be located in dist folder where single excutable file located
The name of manifest file must be same as output file.
If manifest file is located in dist folder, no need to specify --manifest option. --uac-admin is enough.
You can find manifest file at build folder.
Thank you.
Adding up passion053's answer, in my case I used -F instead of --onefile and it works fine for me but yeah you need to add manifest file in the same directory as your single executable.
Note: I used pyinstaller version 3.5. and it works fine for my
Happy Coding!
Adding -r prog.exe.manifest,1 to pyinstaller command line worked for me, after that no need for putting manifest file near exe, pure single exe file.
I downloaded pyinstaller and pywin32 and placed both in the Python32-35 folder
I then put a copy of the gui program(Homework.py) I coded into the Scripts folder that is located in the previous folder
Now I when I open a cmd window and enter the code
pyinstaller--onefile --windowed Homework.py
I am receiving the error in cmd saying
'pyinstaller--onefile' is not recognized as an internal or external command,
operable program or batch file.
use this command to call the module directly:
python -m PyInstaller --onefile --windowed --name="fileName" Homework.py