Answer the question
In order to leave comments, you need to log in
How to compile python code into an executable .exe file?
Hello.
Getting to know Python. I learned that you can compile the code into an .exe file.
Installed the latest version of Python on Windows 10. Downloaded PyInstaller 3.2. In the folder with PyInstaller I threw a script (just a message output) in Python. Through the console entered: pyinstaller myscript.py
As a result, here is the output:
Traceback (most recent call last):
File "C:\Users\radioactive\Desktop\PyInstaller-3.2\pyinstaller.py", line 14, in
from PyInstaller.__main__ import run
File "C:\Users\radioactive\Desktop\PyInstaller -3.2\PyInstaller\__main__.py", line 21, in
import PyInstaller.building.build_main
File "C:\Users\radioactive\Desktop\PyInstaller-3.2\PyInstaller\building\build_main.py", line 32, in
from . .depend import bindepend
File "C:\Users\radioactive\Desktop\PyInstaller-3.2\PyInstaller\depend\bindepend.py", line 38, in
from ..utils.win32.winmanifest import RT_MANIFEST
File "C:\Users\radioactive \Desktop\PyInstaller-3.2\PyInstaller\utils\win32\winmanifest.py", line 97, in
from PyInstaller.utils.win32 import winresource
File "C:\Users\radioactive\Desktop\PyInstaller-3.2\PyInstaller\utils\win32\winresource.py", line 20, in
import pywintypes
ImportError: No module named 'pywintypes'
Answer the question
In order to leave comments, you need to log in
Faced the same problem. A colleague installed python by default, got that both the python interpreter itself and pyinstaller had whitespace characters in the path. Treatment - run through a batch file with the following template:
After successful compilation, the exe file may complain about not found modules - in this case, add the --paths option for pyinstaller:
It is possible to catch another problem - when creating files, it is not possible to pull the dependency on dll-files ( issue ). Some kind of version incompatibility, we get a type mismatch ( continued ). The solution is here .
After that, everything started up and the exe works as it should.
you need to lead in cmd:
pip install pypiwin32
and the problem should be fixed or just pyinstaller does not work for you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question