熊猫进口问题

时间:2017-08-02 18:07:43

标签: python-2.7 pandas import anaconda

我已经在PyCharm中通过Anaconda成功安装了Pandas。不幸的是,当我运行Import Pandas时,这就是我得到的结果:

/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 
"/Users/PycharmProjects/Security upload/Security 
upload.py"
Traceback (most recent call last):
File "/Users/PycharmProjects/Security upload/Security 
upload.py", line 3, in <module>
import pandas
File "/Users/Library/Python/2.7/lib/python/site-
packages/pandas/__init__.py", line 23, in <module>
from pandas.compat.numpy import *
File "/Users/Library/Python/2.7/lib/python/site-
packages/pandas/compat/__init__.py", line 361, in <module>
from dateutil import parser as _date_parser
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/parser.py", line 43, in <module>
from . import tz
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/tz/__init__.py", line 1, in <module>
from .tz import *
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/tz/tz.py", line 23, in <module>
from ._common import tzname_in_python2, _tzinfo, _total_seconds
File "/Users/Library/Python/2.7/lib/python/site-
packages/dateutil/tz/_common.py", line 2, in <module>
from six.moves import _thread
ImportError: cannot import name _thread

有人可以提供一些有关如何处理解决方案的见解吗?

2 个答案:

答案 0 :(得分:2)

根据herehere,您需要修复dateutil包。

pip uninstall python-dateutil
pip install python-dateutil --upgrade

也许这个:

sudo pip uninstall python-dateutil
sudo pip install python-dateutil==2.2

答案 1 :(得分:0)

面对同样的问题,开始安装jupyter并得到很少的错误

重新安装ipython对我有用

sudo -H pip install --ignore-installed -U ipython

我还需要重新安装pyzmq

sudo -H pip install --ignore-installed -U pyzmq

在此之后,我在ipython中重新运行了导入的熊猫并成功了