Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pyinstaller help
#1
Im attempting to make a python file I made into a .exe file I installed pyinstallerusing the command:

pip install pyinstaller

it said it installed successfully. Then when I run the command to convert the .py file into the .exe (this command):

pyinstaller --onefile -w disable.py

it gives me this:

'pyinstaller' is not recognized as an internal or external command,

operable program or batch file.

anyone know a fix for this?
Reply
#2
(May-05-2020, 01:03 AM)jacovb13 Wrote: 'pyinstaller' is not recognized as an internal or external command,
Python in not in Windows Path look here at Fixing Path if needed.
The placement is ‪root_python\Scripts\pyinstaller.exe
Look at image in link so eg if use 3.8(you may have the long default path) .....python38\scripts\ shall also be in Environment Variables Path.
Restart Pc,test again.
Reply
#3
(May-05-2020, 01:33 AM)snippsat Wrote:
(May-05-2020, 01:03 AM)jacovb13 Wrote: 'pyinstaller' is not recognized as an internal or external command,
Python in not in Windows Path look here at Fixing Path if needed.
The placement is ‪root_python\Scripts\pyinstaller.exe
Look at image in link so eg if use 3.8(you may have the long default path) .....python38\scripts\ shall also be in Environment Variables Path.
Restart Pc,test again.
Thanks that helped! But now im running into a new error, it runs through everything until I get this: raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (1920, 'LoadLibraryEx', 'The file cannot be accessed by the system')

you would happen to know a fix for this would you? if not no worries youve helped me more than anyone else so thanks again!
Reply
#4
Try run cmd as administrator

Look post for running in virtual environment.
Reply
#5
(May-05-2020, 02:00 AM)snippsat Wrote: Try run cmd as administrator

Look post for running in virtual environment.
Running as admin didn fix. For the code in the post do I put it in a python script and run it or do I put it in the command prompt? thanks again!
Reply
#6
try running your install on pip3.

When first learning python on raspberian i followed a guide that installed python2. This overlapped with python3. I quickly realized that I had been installing onto the python2 instance with "pip".

As a result I had to add this to the 1st line of all my scripts (to force the use of python3 over python2).

#!/usr/bin/python3

I recommend using PIP3 install {package name}

Retest and let me know your results. -TonyTech
Reply
#7
@tonytech the part with pip is working for him,is Pyinstaller that he has problem with.
pip3 is something used on Linux,not Windows as he use.

(May-05-2020, 02:29 AM)jacovb13 Wrote: For the code in the post do I put it in a python script and run it or do I put it in the command prompt? thanks again!
All is done from command prompt(cmd) or cmder as i use.
You start cmd and do exactly what i post.

I can use cmd as a quick example.
Full run from start:
Microsoft Windows [Version 10.0.18362.778]
(c) 2019 Microsoft Corporation. Med enerett.

C:\Users\Tom>cd\

# The folder i use,you can use what you want
C:\>cd code

# Make virtual enviromnent
C:\code>python -m venv pygame_env

# cd in
C:\code>cd pygame_env

# Activate enviromnent
C:\code\pygame_env>C:\code\pygame_env\Scripts\Activate

# See (pygame_env) when active,test pip it do now point to this folder
(pygame_env) C:\code\pygame_env>pip -V
pip 19.0.3 from c:\code\pygame_env\lib\site-packages\pip (python 3.7)

# Install Pyinstaller and Pygame
(pygame_env) C:\code\pygame_env>pip install pyinstaller pygame
Collecting pyinstaller
Collecting pygame .....
  
Successfully installed altgraph-0.17 future-0.18.2 pefile-2019.4.18 pygame-1.9.6
 pyinstaller-3.6 pywin32-ctypes-0.2.0

(pygame_env) C:\code\pygame_env>
Leave cmd open.
Now at this point you copy @metulburr pong example here into a editor and save it as pong.py
Save it root folder so for me this is now C:\code\pygame_env\pong.py.
Now into cmd again

Use Pyinstaller:
(pygame_env) C:\code\pygame_env>pyinstaller --onefile --noconsole pong.py
165 INFO: PyInstaller: 3.6
166 INFO: Python: 3.7.3
167 INFO: Platform: Windows-10-10.0.18362-SP0
170 INFO: wrote C:\code\pygame_env\pong.spec
.....
14335 INFO: Appending archive to EXE C:\code\pygame_env\dist\pong.exe
14352 INFO: Building EXE from EXE-00.toc completed successfully.
At this point pong.exe is in dist folder,you can run in from File Explorer doubleclick on in it.
From cmd,no also can to this without virtual environment that part is finish
# cd to dist
(pygame_env) C:\code\pygame_env>cd dist

# List files
(pygame_env) C:\code\pygame_env\dist>dir
 Volume in drive C has no label.
 Volume Serial Number is EED7-45CC

 Directory of C:\code\pygame_env\dist

05.05.2020  10:55    <DIR>          .
05.05.2020  10:55    <DIR>          ..
05.05.2020  10:55         8 005 859 pong.exe
               1 File(s)      8 005 859 bytes
               2 Dir(s)  52 245 733 376 bytes free

# Start pong game
(pygame_env) C:\code\pygame_env\dist>pong

(pygame_env) C:\code\pygame_env\dist>

Search for error on web
If it work in a virtual environment as posted over and not OS Python.
I would uninstall and follow install here Python 3.8 (3.6-3.7) and pip installation under Windows.
Reply
#8
Successfully installed pyinstaller-4.1.dev0

C:\Users\Gopal\Desktop\project>pyinstaller --onefile convert.pyw
'pyinstaller' is not recognized as an internal or external command,
operable program or batch file.




i follow the instruction as you mentioned above but still showing same error
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020