收到 os 错误 python 找不到库

getting os error python library not found

我在 windows 10 上安装了 python3.9。我创建了一个虚拟环境并安装了我的程序所需的所有软件包,然后我 运行 pyinstaller 创建了一个可执行文件和收到以下错误消息:OSError: Python library not found: libpython39m.dll, python39.dll, libpython39.dll, libpython3.9.dll, lib python3.9m.dll

我需要安装 python 到我的虚拟环境文件夹吗?我查看了其他类似但不理解解决方案的问题。我是创建 exe 的新手。

前段时间遇到依赖和PyInstaller的问题,我通过安装Python 3.8.6和PyInstaller解决了:

python.exe -m pip install --upgrade pip
python.exe -m pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

最近遇到了同样的问题,通过以下步骤成功解决了这个问题:

1 - 确保删除所有通过 windows AppStore 安装的 python,然后从 here

重新安装

2 - [重要 - 但容易出错] 删除之前 python 安装创建的虚拟环境并重新安装(包括所有必需的包)

3 - 创建一个新的虚拟环境并按照 -GConelhero 的回答安装 pyinstaller