Python 模块错误
Python module error
嗨,我是 Python 的新手,我想使用已经开发的 tool/code,但我对所使用的模块有疑问。
我用 Python
的 Anaconda 版本安装了 Spider
我正在尝试 运行 下面的代码,
https://code.google.com/p/quantandfinancial/source/browse/trunk/example_black_litterman.py
如果我对代码的理解正确,它引用了下面的自定义模块 https://code.google.com/p/quantandfinancial/source/browse/trunk/structures/quote.py?r=25
我将代码的两部分存储在 C:\Users\Michal\Documents\Python Scripts
中,而 Python 安装在 C:\Anaconda3
中,当我 运行 代码时出现错误
File "C:/Users/Michal/Documents/Python Scripts/Black-Litterman.py", line 4, in <module>
from structures.quote import QuoteSeries
ImportError: No module named 'structures'
请帮忙我怎样才能得到这个代码运行ning?
您需要这样做:
pip install structures
最好的办法可能是先 make a conda
environment,然后您可以在那里管理您需要的所有包。
pip install structures 从正常 windows cmd
为我工作
C:\Users\user>pip install structures
您正在使用 pip 版本 7.0.3,但是版本 7.1.2 可用。
您应该考虑通过 'python -m pip install --upgrade pip'
命令升级。
> Collecting structures
> Downloading structures-2.0.2.tar.bz2
> Installing collected packages: structures
> Running setup.py install for structures
> Successfully installed structures-2.0.2
嗨,我是 Python 的新手,我想使用已经开发的 tool/code,但我对所使用的模块有疑问。 我用 Python
的 Anaconda 版本安装了 Spider我正在尝试 运行 下面的代码,
https://code.google.com/p/quantandfinancial/source/browse/trunk/example_black_litterman.py
如果我对代码的理解正确,它引用了下面的自定义模块 https://code.google.com/p/quantandfinancial/source/browse/trunk/structures/quote.py?r=25
我将代码的两部分存储在 C:\Users\Michal\Documents\Python Scripts
中,而 Python 安装在 C:\Anaconda3
中,当我 运行 代码时出现错误
File "C:/Users/Michal/Documents/Python Scripts/Black-Litterman.py", line 4, in <module>
from structures.quote import QuoteSeries
ImportError: No module named 'structures'
请帮忙我怎样才能得到这个代码运行ning?
您需要这样做:
pip install structures
最好的办法可能是先 make a conda
environment,然后您可以在那里管理您需要的所有包。
pip install structures 从正常 windows cmd
为我工作C:\Users\user>pip install structures
您正在使用 pip 版本 7.0.3,但是版本 7.1.2 可用。
您应该考虑通过 'python -m pip install --upgrade pip'
命令升级。
> Collecting structures
> Downloading structures-2.0.2.tar.bz2
> Installing collected packages: structures
> Running setup.py install for structures
> Successfully installed structures-2.0.2