Python Forum
Python 3.6 to executable
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python 3.6 to executable
#6
Here a run,i must use virtual environment because pyinstaller give error on my messy OS python.
I use cmder,but command is the same in cmd except(ls which is dir(cmd)).
# Make enviroment
C:\1
λ python -m venv qustion_env

# cd in
C:\1
λ cd qustion_env

# Activate enviroment,will see (qustion_env)
C:\1\qustion_env
λ C:\1\qustion_env\Scripts\Activate

# Install pyinstaller
(qustion_env) C:\1\qustion_env
λ pip install pyinstaller
Collecting pyinstaller
Collecting future (from pyinstaller)
Collecting pefile>=2017.8.1 (from pyinstaller)
Collecting macholib>=1.8 (from pyinstaller)
  Using cached macholib-1.9-py2.py3-none-any.whl
Requirement already satisfied: setuptools in c:\1\qustion_env\lib\site-packages (from pyinstaller)
Collecting altgraph>=0.15 (from macholib>=1.8->pyinstaller)
  Using cached altgraph-0.15-py2.py3-none-any.whl
Installing collected packages: future, pefile, altgraph, macholib, pyinstaller
Successfully installed altgraph-0.15 future-0.16.0 macholib-1.9 pefile-2017.11.5 pyinstaller-3.3.1

# Install pypiwin32 needed bye pyinstaller
(qustion_env) C:\1\qustion_env
λ pip install pypiwin32
Collecting pypiwin32
  Using cached pypiwin32-220-cp36-none-win32.whl
Installing collected packages: pypiwin32
Successfully installed pypiwin32-220

# Your file is game.py
(qustion_env) C:\1\qustion_env
λ ls
Include/  Lib/  Scripts/  game.py  pip-selfcheck.json  pyvenv.cfg

# Run pyinstaller
(qustion_env) C:\1\qustion_env
λ pyinstaller --onefile game.py
.... a lot installing .....

# To the game game.exe and test it
(qustion_env) C:\1\qustion_env
λ cd dist
(qustion_env) C:\1\qustion_env\dist
λ ls
game.exe*

(qustion_env) C:\1\qustion_env\dist
λ game.exe
Press any key and then enter to start ... j
What language do you wish to proceed in? (dutch/english) english
What words do you want to generate? (common/all) common
How many characters do you want the word to have? 4
Traceback (most recent call last):
  File "game.py", line 120, in <module>
  File "game.py", line 28, in howmany
FileNotFoundError: [Errno 2] No such file or directory: 'CommonEnglishWords.txt'
So .exe work as it should,it stop because i don't have CommonEnglishWords.txt,
this is a file you have local on disk.
Reply


Messages In This Thread
Python 3.6 to executable - by DeGerlash - Jan-09-2018, 10:05 PM
RE: Python 3.6 to executable - by snippsat - Jan-09-2018, 11:21 PM
RE: Python 3.6 to executable - by DeGerlash - Jan-10-2018, 08:40 AM
RE: Python 3.6 to executable - by snippsat - Jan-10-2018, 12:34 PM
RE: Python 3.6 to executable - by DeGerlash - Jan-10-2018, 05:27 PM
RE: Python 3.6 to executable - by snippsat - Jan-10-2018, 06:12 PM
RE: Python 3.6 to executable - by DeGerlash - Jan-10-2018, 09:11 PM
RE: Python 3.6 to executable - by snippsat - Jan-10-2018, 09:26 PM
RE: Python 3.6 to executable - by DeGerlash - Jan-12-2018, 01:41 PM
RE: Python 3.6 to executable - by snippsat - Jan-12-2018, 02:26 PM
RE: Python 3.6 to executable - by DeGerlash - Jan-15-2018, 10:10 PM
RE: Python 3.6 to executable - by snippsat - Jan-15-2018, 10:21 PM
RE: Python 3.6 to executable - by DeGerlash - Jan-15-2018, 10:24 PM
RE: Python 3.6 to executable - by snippsat - Jan-15-2018, 10:34 PM
RE: Python 3.6 to executable - by DeGerlash - Jan-16-2018, 01:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Create Python "Executable" from PyCharm? Oliver 8 61,439 Jan-08-2018, 10:52 AM
Last Post: Oliver

Forum Jump:

User Panel Messages

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