1

我正在将 python3.6 与 anaconda3 一起使用。我已经zipline用命令成功安装了pip install zipline

~$ pip install zipline
Collecting zipline
Requirement already satisfied: multipledispatch>=0.4.8 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: Mako>=1.0.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: pandas<0.19,>=0.18.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: tables>=3.3.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: pip>=7.1.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: MarkupSafe>=0.23 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: bottleneck>=1.0.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: scipy>=0.17.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: decorator>=4.0.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: setuptools>18.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: toolz>=0.8.2 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: python-dateutil>=2.4.2 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: numexpr>=2.6.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: patsy>=0.4.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: numpy>=1.11.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: click>=4.0.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: alembic>=0.7.7 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: Cython>=0.25.2 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: sortedcontainers>=1.4.4 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: requests>=2.9.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: sqlalchemy>=1.0.8 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: bcolz<1,>=0.12.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: six>=1.10.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: pandas-datareader<0.6,>=0.2.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: lru-dict>=1.1.4 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: networkx<2.0,>=1.9.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: intervaltree>=2.1.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: empyrical>=0.4.2 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: contextlib2>=0.4.0 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: statsmodels>=0.6.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: Logbook>=0.12.5 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: pytz>=2016.4 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: cyordereddict>=0.2.2 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: requests-file>=1.4.1 in ./anaconda3/lib/python3.6/site-packages (from zipline)
Requirement already satisfied: python-editor>=0.3 in ./anaconda3/lib/python3.6/site-packages (from alembic>=0.7.7->zipline)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./anaconda3/lib/python3.6/site-packages (from requests>=2.9.1->zipline)
Requirement already satisfied: idna<2.7,>=2.5 in ./anaconda3/lib/python3.6/site-packages (from requests>=2.9.1->zipline)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in ./anaconda3/lib/python3.6/site-packages (from requests>=2.9.1->zipline)
Requirement already satisfied: certifi>=2017.4.17 in ./anaconda3/lib/python3.6/site-packages (from requests>=2.9.1->zipline)
Requirement already satisfied: requests-ftp in ./anaconda3/lib/python3.6/site-packages (from pandas-datareader<0.6,>=0.2.1->zipline)
Installing collected packages: zipline
Successfully installed zipline-1.2.0

但是,安装后,当我运行以下代码时出现错误。

import zipline as zp
print(zp.__version__)

.

Traceback (most recent call last):
  File "/Users/chunyinwong/Documents/PycharmProjects/IB/ziplinetut.py", line 1, in <module>
    import zipline as zp
  File "/anaconda3/lib/python3.6/site-packages/zipline/__init__.py", line 20, in <module>
    from . import data
  File "/anaconda3/lib/python3.6/site-packages/zipline/data/__init__.py", line 1, in <module>
    from . import loader
  File "/anaconda3/lib/python3.6/site-packages/zipline/data/loader.py", line 17, in <module>
    import logbook
  File "/anaconda3/lib/python3.6/site-packages/logbook/__init__.py", line 14, in <module>
    from .base import (
  File "/anaconda3/lib/python3.6/site-packages/logbook/base.py", line 19, in <module>
    from logbook.concurrency import (greenlet_get_ident, thread_get_ident,
ImportError: cannot import name 'thread_get_ident'

Process finished with exit code 1

我尝试在 Jupyter notebook 和 Pycharm 上运行相同的代码,但结果相同。

任何帮助表示赞赏:)

4

1 回答 1

1

更新logbook到最新版本

由于日志已过时,因此无法导入greenlet_get_ident, thread_get_ident

于 2018-05-07T13:02:32.657 回答