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
Related
i made a python script(flask) that use html and generate a local host link to open my website i also imported some deep learning models to my project what i want is i want to make an exe file that gives me the output is the local host link so i used this command to make it
pyinstaller --onefile main.py
but when i run my exe file it gives me this error
no module named cv2
i also tried this command
pyinstaller spec_an_API.py --onefile --add-data "templates";"templates" --add-data "static";"static"
but same problem
not that my program has no errors i tried to run it from pycharm and it works well
I have created my python script and linked in tkinter UI both .py files are running fine when i ran it visual studio code. But I have converted tkinter UI .py file to .exe file to run my python script in executable file. I have successfuly converted the executable file. But when i run through the executable file(Application) No Such file in directory error coming
'c:\users\username\appdate\local\temp_MEI16402\myprogram.py' no such file or directory
This is temp location
But i have my UI.py,myprogram.py in same location
how to solve this error. Please help.
To import myprogram.py into UI.py you can do this:
import myprogram.py
The when you build it into an .exe file with pyinstaller you can add the --onefile option to build both scripts into one file. Here's an example:
pyinstaller --onefile UI.py
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
I have a simple scipt that gives me the time to a specific date and i'm using pyinstaller with this command to convert it to a .exe file to give to my friend:
pyinstaller --onefile --windowed "D:/Documents/code/own/python/sages_birthday/time_till_meetup.py"
When i then try to execute the created file i get this window as an error:
I have made a file with --console instead of --windowed to try and get more information, but i didn't even get the error to pop up or any other information.
Step 1: Add Python to Windows Path
Step 2: Open the Windows Command Prompt
Step 3: Install the Pyinstaller Package
pip install pyinstaller
Step 4: Save your Python Script
Step 5: Create the Executable using Pyinstaller
cd followed by the location where your Python script is stored
Step 6: pyinstaller --onefile pythonScriptName.py
Step 7: Run the Executable
Few additional files got created at that location. To find the executable
file, open the dist folder:
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!