【发布时间】:2014-01-22 14:18:13
【问题描述】:
Spyder 与 numpy 和 pandas 完美配合,但使用 Quandl 我收到以下错误(在 spyder 中):
>>> import Quandl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Quandl
但从终端 Quandl 安装没有问题:
$ sudo easy_install quandl
Password:
Searching for quandl
Reading http://pypi.python.org/simple/quandl/
Best match: Quandl 1.8.1
Downloading https://pypi.python.org/packages/source/Q/Quandl/Quandl-1.8.1.tar.gz#md5=f67bef937eb7522d70cf39ed0de740c1
Processing Quandl-1.8.1.tar.gz
Running Quandl-1.8.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-BEwINw/Quandl-1.8.1/egg-dist-tmp-aBuphk
zip_safe flag not set; analyzing archive contents...
Adding Quandl 1.8.1 to easy-install.pth file
Installed /Library/Python/2.7/site-packages/Quandl-1.8.1-py2.7.egg
Processing dependencies for quandl
Finished processing dependencies for quandl
我也可以直接从终端直接使用该库(在 python2.7 中):
$ python2.7
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Quandl
>>> data= Quandl.get(['GOOG/NASDAQ_AAPL.4','GOOG/NASDAQ_MSFT.4'])
No authentication tokens found: usage will be limited.
See www.quandl.com/api for more information.
Returning Dataframe for [u'GOOG.NASDAQ_AAPL.4', u'GOOG.NASDAQ_MSFT.4']
>>> data
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 8294 entries, 1981-03-11 00:00:00 to 2014-01-03 00:00:00
Data columns (total 2 columns):
GOOG.NASDAQ_AAPL - Close 8294 non-null values
GOOG.NASDAQ_MSFT - Close 7027 non-null values
dtypes: float64(2)
关于 Spyder 为何不与 Quandl 合作的任何意见?
一定是比我先尝试攀登这座山的人。
通过stackoverflow查看时未发现解决方案,但谷歌小组向我指出:
【问题讨论】:
-
只是一个想法:你能重新启动 Spyder 并检查吗?
-
@NipunBatra - 重新启动了 Spyder。不幸的是还是同样的问题。
-
(Spyder dev here) 您在使用我们的 Mac 原生应用吗?我的意思是你从我们的 dmg 安装程序那里得到的那个?
-
@CarlosCordoba 我在回答中引用了您的解决方案。
-
太棒了!那么快乐编码:-)
标签: python-2.7 numpy pandas spyder quandl