我刚开始使用pycharm。我想使用tabula-py,当我尝试导入tabula时,它给出了以下错误:
import tabula
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Applications/PyCharm
CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21,
in do_import
module = self._system_import(name, *args, **kwargs)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/tabula/__init__.py", line 1, in <module>
from .wrapper import read_pdf
File "/Applications/PyCharm
CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21,
in do_import
module = self._system_import(name, *args, **kwargs)
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages/tabula/wrapper.py", line 17, in <module>
import pandas as pd
File "/Applications/PyCharm
CE.app/Contents/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21,
in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: No module named pandas
当我尝试导入大熊猫时,它也是同样的错误。我该如何解决这个问题?
pip
的输出:
要求已经满足:/Users/Rexon/Library/Python/2.7/lib/python/site-packages中的pandas已满足要求:/Users/Rexon/Library/Python/2.7/lib中的numpy&gt; = 1.9.0 / python / site-packages(来自pandas)需求已满足:/Users/Rexon/Library/Python/2.7/lib/python/site-packages(pandas)中的python-dateutil已满足要求:pytz&gt; = 2011k in / Users / Rexon / Library / Python / 2.7 / lib / python / site-packages(来自pandas)要求已经满足:/Users/Rexon/Library/Python/2.7/lib/python/site-packages中的六个&gt; = 1.5蟒)
答案 0 :(得分:1)
您的错误说
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-
packages
但你的点子说
/Users/Rexon/Library/Python/2.7/lib/python/site-packages
确保你的终端和pycharm使用相同的python路径。
答案 1 :(得分:0)
在Pycharm中,转到首选项,然后设计解释器并单击“+”按钮将库添加到项目解释器。
您的项目$ PYTHONPATH环境变量不包含pip安装模块的目录。