Daggerpov
Daggerpov

Reputation: 404

Pyinstaller: OSError: Python library not found

I have Python 3.9.6 installed, but also the same version through pyenv which I set as my global defaulted version so that's what should be showing up here as I ran this command: pyinstaller --onefile main.py

OSError: Python library not found: Python3, Python, libpython3.9.dylib, libpython3.9m.dylib, .Python
    This would mean your Python installation doesn't come with proper library files.
    This usually happens by missing development package, or unsuitable build parameters of Python installation.

    * On Debian/Ubuntu, you would need to install Python development packages
      * apt-get install python3-dev
      * apt-get install python-dev
    * If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)

As my selected (and default) Python interpreter ~/.pyenv/versions/3.9.6/bin/python

Upvotes: 3

Views: 3166

Answers (1)

Chris May
Chris May

Reputation: 822

If you used pyenv to install your python version, they have a FAQ about this error.

The way I got it to work was to uninstall the version of python I wanted to use and then reinstall it with this command:

env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.10.2

Then to get the correct version activated, I had to run:

pyenv rehash

Upvotes: 10

Related Questions