且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

无法从 site-packages 目录加载通过 pip 安装的 Python 模块

更新时间:2022-06-14 04:25:20

/usr/bin/python 是 OS X 自带的 python 的可执行文件./usr/local/lib 是仅用于用户安装的程序的位置,可能来自 Python.org 或 Homebrew.因此,您混合了不同的 Python 安装,而更改 Python 路径只是针对为不同安装安装的不同软件包的部分解决方法.

/usr/bin/python is the executable for the python that comes with OS X. /usr/local/lib is a location for user-installed programs only, possibly from Python.org or Homebrew. So you're mixing different Python installs, and changing the python path is only a partial workaround for different packages being installed for different installations.

为了确保你使用与特定python相关的pip,你可以运行python -m pip install ,或者去看看什么路径上的 pip 是或符号链接到.

In order to make sure you use the pip associated with a particular python, you can run python -m pip install <pkg>, or go look at what the pip on your path is, or is symlinked to.