我的python 2.7代码如下:
import pandas as pd
from pandas import DataFrame
DF_rando = DataFrame([1,2,3])
...然后当我执行时,我收到关于dateutil.tz
的奇怪错误。
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/mattobrien/pandas_test.py
No module named dateutil.tz
Traceback (most recent call last):
File "/Users/mattobrien/pandas_test.py", line 2, in <module>
import pandas as pd
File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 7, in <module>
from . import hashtable, tslib, lib
File "pandas/tslib.pyx", line 37, in init pandas.tslib (pandas/tslib.c:76999)
ImportError: No module named dateutil.tz
Process finished with exit code 1
很奇怪。我检查确实安装了dateutil.tz
。我卸载Pandas
并重新安装它以确定。那里没有问题。
为什么我收到此错误?
答案 0 :(得分:17)
需要这两行。
sudo pip install python-dateutil --upgrade
sudo pip install pytz --upgrade