且构网

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

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

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

的/ usr / bin中/ Python的是带有OS X. 的/ usr / local / lib目录是只可能来自Python.org或家酿用户安装程序的位置。只被安装那么你是混合不同的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.

为了确保您使用 PIP 与特定的蟒蛇相关联,可以运行蟒蛇-m PIP安装< PKG> ,或者去看看你的路径是什么 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.