python-Can可以在Pycharm中导入模块,而我可以在终端中导入相同的模块?

时间:2016-02-23 04:12:16

标签: python python-2.7

我安装了essentia brew install essentia --HEAD 信息: Python modules have been installed and Homebrew's site-packages is not in your Python sys.path, so you will not be able to import the modules this formula installed. If you plan to develop with these modules, please run: mkdir -p /Users/yangyy/Library/Python/2.7/lib/python/site-packages echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/yangyy/Library/Python/2.7/lib/python/site-packages/homebrew.pth

我按照消息指示并成功安装了essentia。 该模块可以在终端导入: Python 2.7.11 (default, Feb 23 2016, 00:59:46) [GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin Type "help", "copyright", "credits" or "license" for more information. -import essentia -exit() $ which python /usr/local/bin/python

我使用Pycharm作为我的IDE。我尝试了所有解释器,但仍无法导入此模块。

在python中,我尝试过:

>>> import essentia
>>> reload(essentia)
<module 'essentia' from '/usr/local/lib/python2.7/site-packages/essentia/__init__.pyc'>

1 个答案:

答案 0 :(得分:0)

Pycharm不会接受包依赖项,而是包含您应该为项目启动的包。 所以,为此,你应该去

settings -> project Interpreter 

然后选择你的项目,然后检查你的包裹,然后点击,

apply <-button

就是这样