@
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.