使用 Pandas 时,dateutil.tz 包显然丢失了?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/26920164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
dateutil.tz package apparently missing when using Pandas?
提问by tumultous_rooster
My python 2.7 code is as follows:
我的python 2.7代码如下:
import pandas as pd
from pandas import DataFrame
DF_rando = DataFrame([1,2,3])
...and then when I execute, I get a strange error regarding dateutil.tz.
...然后当我执行时,我收到一个关于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
Very strange. I checked an indeed dateutil.tzis indeed installed. I uninstalled Pandasand reinstalled it to be sure. No issues there.
很奇怪。我检查了确实dateutil.tz确实安装了。我卸载Pandas并重新安装它以确保。那里没有问题。
Why am I getting this error?
为什么我收到这个错误?
回答by tumultous_rooster
Needed these 2 lines.
需要这两行。
sudo pip install python-dateutil --upgrade
sudo pip install python-dateutil --upgrade
sudo pip install pytz --upgrade
sudo pip install pytz --upgrade

