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)).
this is a file you have local on disk.
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.