MacPorts pip install 将 .so 文件链接到错误的 python MacOS 10.11 可执行文件

MacPorts pip install links .so file to wrong python executable on MacOS 10.11

我正在使用 MacOS 10.11,除了本机 Python 安装之外,我还通过 MacPorts 安装了 Python 和 Pip。 pythonpip 针对各自的 MacPorts 版本 linked。

但是,通过

安装包时
sudo pip install <my-package>

该包的特定 .so 文件是针对本机 Python 可执行文件 linked 的。更准确地说,otool -L.so 文件上的输出是

/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.5)

而 Python 的 MacPorts 版本位于

/opt/local/Library/Frameworks/Python.framework/Versions/2.7/

如何强制 Pip 使用正确的 Python 版本来对抗 link?

简而言之:你不能。

不是pip的问题。 nupic 包依赖于 nupic.bindings 包,其中包含您注意到的 _math.so,并且目前通过 PyPI 以仅二进制形式分发:

https://pypi.python.org/pypi/nupic.bindings

您可以编译自己的 nupic.bindings 包,但构建过程看起来相当复杂,这可能就是为什么他们仅分发二进制文件的原因:

https://github.com/numenta/nupic.core

祝你好运!