add the python scripts folder to your PATH. to do this you need to note the directory of the scripts folder. this is my directory C:\Python39\Scripts\ but yours can vary. just check if it is the same. after that follow these instructions: Show In Search, search for and then select: System (Control Panel) Click the Advanced system settings link. Click Environment Variables. In the section System Variables find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New. In the Edit System Variable (or New System Variable) window, copy the name of the directory. Click OK. Close all remaining windows by clicking OK. Also see if u are running cmd as admin I am trying to use pyinstaller in cmd but I receive error: When I use this command in the Scripts folder in python , it works: How to solve this? You have to modify your User PATH environment variable to include C:\Users\[USERNAME]\AppData\Local\Programs\Python\Python36-32\Scripts. For how to add/modify your PATH environment variables, see this. For Python 3.7, you will have to add the Scripts folder from AppData/Roaming (%appdata%) to the PATH variable. C:\Users\%USERNAME%\AppData\Roaming\Python\Python37\Scripts Copy 'pyinstaller.exe' to the folder you have the .py file you want to convert. When you are done, just delete 'pyinstaller.exe'. Good luck. I did correctly configured my script path, I had to run python -m PyInstaller script.py in order for it to work For every script I have to follow this pattern, python -m [scriptname] [args] python version 3.10.0 First, you need to know where is the pyinstaller locates. In my case, I ran pip uninstall pyinstallerBefore it's being uninstalled, it will ask you to confirm if you want to remove the following file... c:\users\USERNAME\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\scripts\pyinstaller.exeGreat! Now by doing this, you know your path to pyinstaller. Simple type 'No' and exit the uninstallation as our purpose is just to get the path. Now just add this path to the PATH variable. c:\users\USERNAME\appdata\local\packages\pythonsoftwarefoundation.python.3.9_qbz5n2kfra8p0\localcache\local-packages\python39\scripts\For how to change your PATH variable. Check here This solution work for Python 3.9 First of all find the pyinstaller.exe location. To do this you could try this trick: (do not press 'y' just look at the above copy the path what you are looking for) pip uninstall pyinstallerBefore typing anything, it will show you the path where the pyinstaller.exe is. After that copy the location and run this command on terminal: (it is an example) python C:\Users\[YOUR_USER_NAME]\AppData\...Scripts\pyinstaller.exe --onefile [your_script_name.py]Had exactly the same issue:
Copy youe script folder's path C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts and paste it in: environment varibales> system varibales> path and save it. Then restart your PC and try running pyinsatller from anywhere it will work. Goto - "C:\Users\Username\anaconda3\Scripts" path and copy "pyinstaller.exe" and paste it in the directory where you want to use pyinstaller, it worked for me I found How we should fix this error : C:\Users\username>pyinstaller 'pyinstaller' is not recognized as an internal or external command, operable program or batch file.We should enter this code in cmd pip install pyinstaller if it is doesn't work again you should go C:/user/pc name/Appdata (Appdata folder is hide)/python now you should copy script folder and C:/program files/python39 and copy site package to C:/program files/python39/lib then if you type pyinstaller in cmd you see it work
Oddly, for me changing the capitalization resolved the issue. I typed python -m [scriptname] [args]. In [scriptname] I typed PyInstaller instead of pyinstaller and it actually worked. I tried both ways multiple times.
if you cannot do anything or you have less time, you can make the virtual environment and install pyinstaller there, then generate executable file Enter in Administrative Console: pip install pyinstaller If installing pyinstaller and creating the 'path' variables still does not work, u can use this workaround: Locate pyinstaller.exe from possible python directory like C:\Users\ "UserName" \AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts Copy it to the dir that you have the .py file you want to compile as .exe Use following command in terminal: .\pyinstaller --onefile YOUR_FILE_NAME.py First, you should check the configuration, ports, and active process. After checking these processes, you can check the local folder. You will find the pyinstaller inside this folder; there will be a pyinstaller.exe file. Then set the path C:\Users\[username]\AppData\Local\Programs\Python\Python39\Scripts, C:\Users\[username]\AppData\Local\Programs\Python\Python39. After that, you can run the command pyinstaller --onefile -w filename.py If you don't have pip in the PATH of your cmd, then you can run these commands in cmd for windows.
Why is PyInstaller not working?The most common reason a PyInstaller package fails is that PyInstaller failed to bundle a required file. Such missing files fall into a few categories: Hidden or missing imports: Sometimes PyInstaller can't detect the import of a package or library, typically because it is imported dynamically.
Where is PyInstaller exe located?After installation, the pyinstaller binary is located in your virtual environment's bin/ directory, or where your Python executable is located. If that directory isn't in your PATH , include the whole path when you run pyinstaller .
How do I add PyInstaller to path?type pip install pyinstaller .. Click file at the top left corner.. Click settings.. Find your project on the toolbar on the left.. Click project interpreter.. To the right there will be a plus sign.. Click that and search pyinstaller.. Install.. How do I install PyInstaller on Windows 10?To install PyInstaller: Go to your command prompt (Start -> Run -> cmd) type the following command cd c:\python27\scripts press enter, this should be where your pip.exe file is located. Once you are in this directory type pip install pyinstaller press enter.
|