W
W
webrapist2016-05-04 20:38:09
Python
webrapist, 2016-05-04 20:38:09

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'

I tried to read the man on their site there - I didn’t understand a damn thing. Can anyone help with this matter? I will be very grateful :)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
B
BBmike, 2016-05-04
@BBmike

www.py2exe.org

S
s0ci0pat, 2016-05-05
@s0ci0pat

You need to install pywin32

B
Bombus, 2016-06-27
@Bombus

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.

R
Roma Kotolup, 2021-04-09
@roma2

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 question

Ask a Question

731 491 924 answers to any question