我无法在shell中的python 2.7中导入numpy。我先安装python brew install,然后再安装numpy sudo pip install。我尝试了没有,sudo但出现了拒绝权限错误。无论如何,我得到这个:
brew install
sudo pip install
sudo
ImportError: dlopen(/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyErr_ReplaceException Referenced from: /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so Expected in: flat namespace in /usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
在/usr/local/bin/我有以下内容:
/usr/local/bin/
pip pip2 pip2.7 pip3 pip3.4
和:
python python-config python2 python2-config python2.7 python2.7-config python3 python3-config python3.4 python3.4-config python3.4m python3.4m-config pythonw pythonw2 pythonw2.7
的输出which python是/usr/local/bin/python
which python
/usr/local/bin/python
至于解决方法,请尝试将Python降级为2.7.9,例如:
brew switch python 2.7.9
通过覆盖现有版本,似乎在2.7.10中存在一些特定问题。然后再次重新链接(如果需要)。
还要确保您PYTHONPATH的设置正确(不要在启动文件中的任何位置覆盖它)。
PYTHONPATH