导入 quandl 模块时出现问题
Problems importing quandl module
我正在尝试使用一些 Quandl 数据集创建数据科学项目,但在导入时收到错误消息。
据我所知,quandl 应该全部以小写形式导入,如文档所述here and ,我的导入如下:
import quandl
错误:
ModuleNotFoundError: No module named 'quandl'
我使用 pip install quandl
安装了 quandl。我的 pip 列表输出是:
Package Version
--------------- ---------
asn1crypto 0.24.0
certifi 2019.6.16
cffi 1.12.3
chardet 3.0.4
cryptography 2.7
idna 2.8
inflection 0.3.1
more-itertools 5.0.0
ndg-httpsclient 0.5.1
numpy 1.16.4
pandas 0.24.2
pip 19.1.1
pyasn1 0.4.5
pycparser 2.19
pyOpenSSL 19.0.0
python-dateutil 2.8.0
pytz 2019.1
Quandl 3.4.8
requests 2.22.0
setuptools 41.0.1
six 1.12.0
urllib3 1.25.3
wheel 0.33.4
wincertstore 0.2
我没有 pip3,因为我通过 Anaconda 安装 Python。我是 运行 虚拟环境中的 Jupyter Notebook,我专为此项目创建。你知道,python --version
输出是:
Python 3.7.3
奇怪的部分发生在我尝试 运行 一行 python 脚本与 import quandl
时。这次程序运行没有报错,也就是说ModuleNotFoundError: No module named 'quandl'
的原因是jupyter notebook没有正确找到quandl模块。
作为最后一个资源,我尝试在 jupyter notebook 中安装 quandl:
!pip install quandl
import quandl
输出:
Requirement already satisfied: quandl in c:\users\not_me\.conda\envs\quant\lib\site-packages (3.4.8)
Requirement already satisfied: pandas>=0.14 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.24.2)
Requirement already satisfied: pyOpenSSL in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (19.0.0)
Requirement already satisfied: inflection>=0.3.1 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.3.1)
Requirement already satisfied: numpy>=1.8 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (1.16.4)
Requirement already satisfied: more-itertools<=5.0.0 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (5.0.0)
Requirement already satisfied: pyasn1 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.4.5)
Requirement already satisfied: python-dateutil in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (2.8.0)
Requirement already satisfied: six in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (1.12.0)
Requirement already satisfied: ndg-httpsclient in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.5.1)
Requirement already satisfied: requests>=2.7.0 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (2.22.0)
Requirement already satisfied: pytz>=2011k in c:\users\not_me\.conda\envs\quant\lib\site-packages (from pandas>=0.14->quandl) (2019.1)
Requirement already satisfied: cryptography>=2.3 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from pyOpenSSL->quandl) (2.7)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (2019.6.16)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (1.25.3)
Requirement already satisfied: asn1crypto>=0.21.0 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from cryptography>=2.3->pyOpenSSL->quandl) (0.24.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from cryptography>=2.3->pyOpenSSL->quandl) (1.12.3)
Requirement already satisfied: pycparser in c:\users\not_me\.conda\envs\quant\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.3->pyOpenSSL->quandl) (2.19)
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-614264e6071a> in <module>
1 get_ipython().system('pip install quandl')
----> 3 import quandl
ModuleNotFoundError: No module named 'quandl'
尝试pip3 install quandl
。它通常适用于 Python 3.x
尝试通过运行
安装
!pip install quandl
在 Jupyter notebook 的一个单元格中。如果您的设置正确,则有可能与您需要的 pip 版本相同。
当您想确保使用与该解释器关联的 pip
版本时,您可以使用模块语法而不是独立的 CLI 使用 pip。
python -m pip install quandl
或者,由于您使用的是 Conda,您也可以尝试使用 conda
CLI 安装 quandl
。
conda install quandl
(或 conda
的任何包名)。
问题是 Jupyter 没有正确识别我的虚拟环境。我找到了我的答案 here,解决方法很容易解释。
我正在尝试使用一些 Quandl 数据集创建数据科学项目,但在导入时收到错误消息。
据我所知,quandl 应该全部以小写形式导入,如文档所述here and
import quandl
错误:
ModuleNotFoundError: No module named 'quandl'
我使用 pip install quandl
安装了 quandl。我的 pip 列表输出是:
Package Version
--------------- ---------
asn1crypto 0.24.0
certifi 2019.6.16
cffi 1.12.3
chardet 3.0.4
cryptography 2.7
idna 2.8
inflection 0.3.1
more-itertools 5.0.0
ndg-httpsclient 0.5.1
numpy 1.16.4
pandas 0.24.2
pip 19.1.1
pyasn1 0.4.5
pycparser 2.19
pyOpenSSL 19.0.0
python-dateutil 2.8.0
pytz 2019.1
Quandl 3.4.8
requests 2.22.0
setuptools 41.0.1
six 1.12.0
urllib3 1.25.3
wheel 0.33.4
wincertstore 0.2
我没有 pip3,因为我通过 Anaconda 安装 Python。我是 运行 虚拟环境中的 Jupyter Notebook,我专为此项目创建。你知道,python --version
输出是:
Python 3.7.3
奇怪的部分发生在我尝试 运行 一行 python 脚本与 import quandl
时。这次程序运行没有报错,也就是说ModuleNotFoundError: No module named 'quandl'
的原因是jupyter notebook没有正确找到quandl模块。
作为最后一个资源,我尝试在 jupyter notebook 中安装 quandl:
!pip install quandl
import quandl
输出:
Requirement already satisfied: quandl in c:\users\not_me\.conda\envs\quant\lib\site-packages (3.4.8)
Requirement already satisfied: pandas>=0.14 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.24.2)
Requirement already satisfied: pyOpenSSL in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (19.0.0)
Requirement already satisfied: inflection>=0.3.1 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.3.1)
Requirement already satisfied: numpy>=1.8 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (1.16.4)
Requirement already satisfied: more-itertools<=5.0.0 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (5.0.0)
Requirement already satisfied: pyasn1 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.4.5)
Requirement already satisfied: python-dateutil in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (2.8.0)
Requirement already satisfied: six in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (1.12.0)
Requirement already satisfied: ndg-httpsclient in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (0.5.1)
Requirement already satisfied: requests>=2.7.0 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from quandl) (2.22.0)
Requirement already satisfied: pytz>=2011k in c:\users\not_me\.conda\envs\quant\lib\site-packages (from pandas>=0.14->quandl) (2019.1)
Requirement already satisfied: cryptography>=2.3 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from pyOpenSSL->quandl) (2.7)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (2019.6.16)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from requests>=2.7.0->quandl) (1.25.3)
Requirement already satisfied: asn1crypto>=0.21.0 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from cryptography>=2.3->pyOpenSSL->quandl) (0.24.0)
Requirement already satisfied: cffi!=1.11.3,>=1.8 in c:\users\not_me\.conda\envs\quant\lib\site-packages (from cryptography>=2.3->pyOpenSSL->quandl) (1.12.3)
Requirement already satisfied: pycparser in c:\users\not_me\.conda\envs\quant\lib\site-packages (from cffi!=1.11.3,>=1.8->cryptography>=2.3->pyOpenSSL->quandl) (2.19)
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-614264e6071a> in <module>
1 get_ipython().system('pip install quandl')
----> 3 import quandl
ModuleNotFoundError: No module named 'quandl'
尝试pip3 install quandl
。它通常适用于 Python 3.x
尝试通过运行
安装!pip install quandl
在 Jupyter notebook 的一个单元格中。如果您的设置正确,则有可能与您需要的 pip 版本相同。
当您想确保使用与该解释器关联的 pip
版本时,您可以使用模块语法而不是独立的 CLI 使用 pip。
python -m pip install quandl
或者,由于您使用的是 Conda,您也可以尝试使用 conda
CLI 安装 quandl
。
conda install quandl
(或 conda
的任何包名)。
问题是 Jupyter 没有正确识别我的虚拟环境。我找到了我的答案 here,解决方法很容易解释。