简体   繁体   English

未找到模块:zipline 导入

[英]Module not Found: zipline import

Getting the following stack trace from line:从行获取以下堆栈跟踪:

zipline/zipline/__init__.py", line 17, in <module>
    import numpy as np
ImportError: No module named 'numpy'

however, when I check pip list但是,当我检查pip list

pip list | grep numpy
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
numpy             1.16.6

This all occurs after I clone into the Quantopian/Zipline Github Repo .这一切都发生在我克隆到Quantopian/Zipline Github Repo 之后 I opened an issue on github, after this edit I'll search SO for anything obvious I missed.我在 github 上打开了一个问题,在这个编辑之后我会搜索任何明显我错过的东西。

Environment环境

WSL Ubunut Subsystem WSL Ubuntu 子系统

Pyhon 3.5.5派恩 3.5.5

Bitness: 64位数:64

installed dependencies via sudo apt-get install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev通过sudo apt-get install libatlas-base-dev python-dev gfortran pkg-config libfreetype6-dev安装依赖项

Pip list点子列表

alembic           1.4.2
asn1crypto        0.24.0
bcolz             0.12.1
Bottleneck        1.3.2
certifi           2019.11.28
chardet           3.0.4
click             7.1.1
contextlib2       0.6.0.post1
cycler            0.10.0
cyordereddict     1.0.0
Cython            0.29.15
decorator         4.4.2
empyrical         0.5.3
enum34            1.1.6
funcsigs          1.0.2
idna              2.6
intervaltree      3.0.2
ipaddress         1.0.17
itable            0.0.1
keyring           10.6.0
Logbook           1.5.3
lru-dict          1.1.6
lxml              4.5.0
Mako              1.1.2
MarkupSafe        1.1.1
matplotlib        2.2.4
mercurial         4.5.3
mock              3.0.5
multipledispatch  0.6.0
networkx          1.11
numexpr           2.7.1
numpy             1.16.6
pandas            0.22.0
pandas-datareader 0.8.1
patsy             0.5.1
pinkfish          0.5.1
pip               19.3.1
pycrypto          2.6.1
pygobject         3.26.1
python-dateutil   2.8.1
python-editor     1.0.4
pytz              2019.3
pyxdg             0.25
requests          2.22.0
requests-file     1.4.3
scipy             1.2.2
SecretStorage     2.3.1
setuptools        39.0.1
six               1.14.0
sortedcontainers  2.1.0
SQLAlchemy        1.3.15
statsmodels       0.11.0
tables            3.5.2
toolz             0.10.0
trading-calendars 1.11.5
urllib3           1.25.7
wheel             0.30.0
zipline           1.3.0
WARNING: You are using pip version 19.3.1; however, version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Update更新

running as a script, sudo python test.py returns作为脚本运行, sudo python test.py返回

File "test.py", line 1, in <module>
    import zipline
  File "../zipline/zipline/__init__.py", line 29, in <module>
    from .utils.run_algo import run_algorithm
  File "../zipline/zipline/utils/run_algo.py", line 17, in <module>
    from zipline.data import bundles
  File "../zipline/zipline/data/bundles/__init__.py", line 2, in <module>
    from . import quandl  # noqa
  File "../zipline/zipline/data/bundles/quandl.py", line 17, in <module>
    from . import core as bundles
  File "../zipline/zipline/data/bundles/core.py", line 14, in <module>
    from ..adjustments import SQLiteAdjustmentReader, SQLiteAdjustmentWriter
  File "../zipline/zipline/data/adjustments.py", line 24, in <module>
    from ._adjustments import load_adjustments_from_sqlite
ImportError: No module named _adjustments

The issue arose due to the presence of multiple versions of python .该问题是由于存在多个版本的 python 引起的 Using the python -m pip install <packages> command inside of the zipline/zipline repo, I was able to successful execute import zipline inside a python shellzipline/zipline repo 中使用python -m pip install <packages>命令,我能够在 python shell 中成功执行import zipline

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM