无法导入第 3 方包 [英] Cannot import 3rd party packages
问题描述
我在 OS X 10.9.4 上运行 python 2.7.5.每当我安装一个软件包时,它都会安装到:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
I am running python 2.7.5 on OS X 10.9.4 . Whenever I install a package it installs to: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
我使用 pip install 安装了 py2neo,我使用 pycharm 作为我的 IDE,但是我在使用它时无法导入我安装的模块.在 pycharm 中,它说我的外部库位于:System/Library/Frameworks/Python.framework/Versions/2.7/python/site-packages
I installed py2neo using pip install and I am using pycharm as my IDE but I can't import the module I have installed when using it. In pycharm it says that my external libraries are located at: System/Library/Frameworks/Python.framework/Versions/2.7/python/site-packages
这不是安装包的地方.此外,当我使用解释器时,import 语句确实有效.
which is not where the packages are being installed. Also, the import statement does work when I use the interpretor.
推荐答案
您或许可以修改 python 搜索路径:
You may be able to modify the python search path:
import sys
sys.path.append('/System/Library/Frameworks/Python.framework/Versions/2.7/python/site-packages')
import py2neo
这篇关于无法导入第 3 方包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!