0

I am using Mac OS Big Sur and Python 3.7. I am trying to create an executable file from my python script with pyinstaller, but my python interpreter could not find pyinstaller even though it seems to be installed.

$ /usr/local/bin/python3.7 -m pyinstaller
/usr/local/opt/python/bin/python3.7: No module named pyinstaller

Here you can see pyinstaller is installed.

$ /usr/local/bin/python3.7 -m pip list
Package                   Version
------------------------- -------
altgraph                  0.17.2 
appdirs                   1.4.4  
colour                    0.1.5  
distlib                   0.3.1  
filelock                  3.0.12 
importlib-metadata        3.7.0  
macholib                  1.16   
pip                       19.1.1 
pyinstaller               5.2    
pyinstaller-hooks-contrib 2022.8 
setuptools                41.0.1 
six                       1.15.0 
tkmacosx                  1.0.5  
typing-extensions         3.7.4.3
virtualenv                20.4.2 
wheel                     0.33.4 
zipp                      3.4.0  
$ /usr/local/bin/python3.7 -m pip install pyinstaller
Requirement already satisfied: pyinstaller in /usr/local/lib/python3.7/site-packages (5.2)
Requirement already satisfied: altgraph in /usr/local/lib/python3.7/site-packages (from pyinstaller) (0.17.2)
Requirement already satisfied: pyinstaller-hooks-contrib>=2021.4 in /usr/local/lib/python3.7/site-packages (from pyinstaller) (2022.8)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.7/site-packages (from pyinstaller) (3.7.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from pyinstaller) (41.0.1)
Requirement already satisfied: macholib>=1.8; sys_platform == "darwin" in /usr/local/lib/python3.7/site-packages (from pyinstaller) (1.16)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->pyinstaller) (3.4.0)
Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.7/site-packages (from importlib-metadata; python_version < "3.8"->pyinstaller) (3.7.4.3)

Any help is greatly appreciated!

  • 1
    Does this answer your question? [pyinstaller No module named pyinstaller](https://stackoverflow.com/questions/44740792/pyinstaller-no-module-named-pyinstaller) – Hagbard Jul 22 '22 at 12:48

1 Answers1

0

Pyinstaller has a console_scripts entry point. So you can directly run from the console.

Instead of /usr/local/bin/python3.7 -m pyinstaller , just run pyinstaller command directly, eg: pyinstaller --version

If you are using virtual environment, activate that first before running pyinstaller commands.

You can also run it by using PyInstaller instead of using pyinstaller.

Eg: /usr/local/bin/python3.7 -m PyInstaller --version

sbrunch
  • 91
  • 6