问题
I'm using Python 3.7 32-bit on Windows 10 64-bit. Python was installed from the executable file on the Python website and NOT Anaconda package. When I run pyinstaller from the command prompt, it returns an error: Error Message I've already installed pypiwin32, pywin32 and win32ctypes. But still have the error.
I tried running pyinstaller from Windows CMD, Pycharm, and a virtual environment, all with the necessary libraries installed, but I'm unable to make it work.
I've googled a lot on this issue but unable to find an answer. Can anyone please help?
回答1:
Open python (tested using Python 3.7.4) and check if the modules can be found from the environment without intervening:
python.exe
>>>import pywintypes
>>>import win32api
If successful, the fix is simple. Find the file compat.py inside the PyInstaller folder. and edit the following two lines.
Replace:
from win32ctypes.pywin32 import pywintypes
from win32ctypes.pywin32 import win32api
with
import pywintypes
import win32api
回答2:
I'm running Python 3.6 on a 32-bit Windows 10 64-bit machine. Using the latest stable version from "pip install pyinstaller" I ran into the same error as you.
The fastest way to fix this is to run the following from cmd:
pip uninstall pyinstaller
Then run the following in cmd:
pip install https://github.com/pyinstaller/pyinstaller/tarball/develop
This gives you the version currently in development where they have fixed the issue.
Please see https://media.readthedocs.org/pdf/pyinstaller/latest/pyinstaller.pdf for more information.
来源:https://stackoverflow.com/questions/52194396/unable-to-run-pyinstaller-please-install-pywin32-or-pywin32-ctypes