Dag*_*pov 3 python pyinstaller pyenv
我安装了 Python 3.9.6,但也通过 pyenv 设置了相同的版本,我将其设置为全局默认版本,因此当我运行此命令时,应该显示在此处: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)
Run Code Online (Sandbox Code Playgroud)
作为我选择的(也是默认的)Python 解释器~/.pyenv/versions/3.9.6/bin/python
如果您曾经安装过 python 版本,他们有关于此错误的pyenv
常见问题解答。
我让它工作的方法是卸载我想要使用的 python 版本,然后使用以下命令重新安装它:
env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.10.2
Run Code Online (Sandbox Code Playgroud)
然后为了激活正确的版本,我必须运行:
pyenv rehash
Run Code Online (Sandbox Code Playgroud)