@
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:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
Microsoft Windows [Version 10.0 . 18362.778 ]
(c) 2019 Microsoft Corporation. Med enerett.
C:\Users\Tom>cd\
C:\>cd code
C:\code>python - m venv pygame_env
C:\code>cd pygame_env
C:\code\pygame_env>C:\code\pygame_env\Scripts\Activate
(pygame_env) C:\code\pygame_env>pip - V
pip 19.0 . 3 from c:\code\pygame_env\lib\site - packages\pip (python 3.7 )
(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:
1 2 3 4 5 6 7 8 |
(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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
(pygame_env) C:\code\pygame_env>cd dist
(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
(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.