一、背景
PyCharm执行Python时,找不到自己安装的package,例如pandas、numpy、scipy、scikit等,在执行时报如下错误ImportError: No module named pandas:
Traceback (most recent call last):
File "", line 1, in
File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 20, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: No module named pandas
二、问题解决
(1)pycharm添加Python interpreter;
(2)给添加的Python interpreter添加自已安装的package路径。
1、pycharm添加Python interpreter
打开项目设置(pycharm–>preference)
添加interpreter,选中本地python命令所在目录,注意保持1和2中的interpreter一致
2、给添加的Python interpreter添加自已安装的packa