python - Pyinstaller: OSError: Python library not found
问题描述
我安装了 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)
作为我选择(和默认)的 Python 解释器~/.pyenv/versions/3.9.6/bin/python
解决方案
如果你曾经pyenv
安装过你的 python 版本,他们有一个关于这个错误的常见问题解答。
我让它工作的方法是卸载我想使用的python版本,然后用这个命令重新安装它:
env PYTHON_CONFIGURE_OPTS="--enable-framework" pyenv install 3.10.2
然后要激活正确的版本,我必须运行:
pyenv rehash
推荐阅读
- mongodb - ObjectID `_id` 是在哪里生成的?
- sql-server - 为什么我的 SQL Server 调用有时会停滞 14.3 秒?
- javascript - 如何在three.js中绝对在相机上翻译Z?
- excel - 使用宏比较两个 Excel 工作表中的列并将匹配项添加到第三个工作表
- mysql - 如何获取表之间的关系并区分一对一和一对多?
- java - 如果有多个/一个匹配项,是否有任何有效的方法来循环设置并保存值?
- r - 为什么从 r 输出到 excel 表(使用 xlsx 包)时,数据框列标题中的问号显示为句点?
- rust - 如何返回按结构成员过滤的过滤器迭代器
- asp.net - 如何为 ASP.NET MVC 5 和 Web Api 2 设置集成测试?
- javascript - 如何使 Owl Carousel 点导航按钮可访问?