2

我对 Python 很陌生。我最近刚刚通过 PIP 安装了 Google Finance Python 包。

但是一旦我尝试跑步

import googlefinance

我收到一条错误消息:-

没有名为 googlefinance 的模块

.

有人可以帮帮我吗?我不确定到底出了什么问题

4

2 回答 2

1

对我来说很好:

richy@cisco → pip install googlefinance
Collecting googlefinance
Downloading googlefinance-0.7.tar.gz
Installing collected packages: googlefinance
Running setup.py install for googlefinance
Successfully installed googlefinance-0.7

richy@cisco → python
Python 2.7.9 (default, Jan  7 2015, 11:49:12)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import googlefinance
>>>

这个问题可能与混合 python2 和 python3 有关吗?如果您想在 python3 中使用该模块(假设它受支持),您必须使用 pip3 来安装它。

richy@cisco → python3
Python 3.4.3 (default, Feb 25 2015, 21:28:45)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import googlefinance
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'googlefinance'
于 2015-06-02T19:06:42.427 回答
0

你可能需要做 sudo pip install googlefinance

当它提示输入您的密码时。我有类似的问题,使用 sudo pip 对我有用!

于 2015-12-07T19:53:01.807 回答