来自requests.exceptions导入ConnectionError,ConnectTimeout,ReadTimeout

时间:2017-01-27 16:26:19

标签: python pandas

我正在尝试执行以下代码

from pandas_datareader import data, wb

但我收到的错误是

  来自requests.exceptions的

导入ConnectionError,ConnectTimeout,   ReadTimeout       ImportError:无法导入名称ConnectTimeout

我已经安装了pandas_datareader请求 我不确定问题究竟在哪里。有人可以帮我吗?

我试图使用Python shell以及..

>>>import pandas_datareader

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pandas_datareader/__init__.py", line 3, in <module>
from .data import (get_components_yahoo, get_data_famafrench, get_data_google, get_data_yahoo, get_data_enigma,  # noqa
File "/usr/local/lib/python2.7/dist-packages/pandas_datareader/data.py", line 7, in <module>
from pandas_datareader.google.daily import GoogleDailyReader
File "/usr/local/lib/python2.7/dist-packages/pandas_datareader/google/daily.py", line 1, in <module>
from pandas_datareader.base import _DailyBaseReader
File "/usr/local/lib/python2.7/dist-packages/pandas_datareader/base.py", line 13, in <module>
from pandas_datareader._utils import (RemoteDataError, SymbolWarning,
File "/usr/local/lib/python2.7/dist-packages/pandas_datareader/_utils.py", line 10, in <module>
import requests_ftp
File "/usr/local/lib/python2.7/dist-packages/requests_ftp/__init__.py", line 21, in <module>
from .ftp import FTPAdapter, monkeypatch_session
File "/usr/local/lib/python2.7/dist-packages/requests_ftp/ftp.py", line 13, in <module>
from requests.exceptions import ConnectionError, ConnectTimeout,      ReadTimeout
ImportError: cannot import name ConnectTimeout

2 个答案:

答案 0 :(得分:1)

看起来你有一个非常古老的request模块版本。

尝试更新它。

答案 1 :(得分:-1)

我在普通的virtualenv(具有相同的点数要求)中使用相同的要求,而不是在cloud9上工作。有效。我想这与环境平台有关。