我已经安装了 zipline(来自 Quantopian),以便能够回测我的投资策略。
但是,我无法将 zipline 或其任何组件导入我的 Spyder IDE。
如果它与这个问题有任何关系,我将使用 anaconda 的 Spyder v.3.2.8 64 位 IDE 进行开发,并使用其集成控制台进行直接输出。我创建了环境“env_zipline”并激活了它。
作为早期尝试的一部分,我创建了一个环境
conda create -n dev && activate dev
conda install -c Quantopian zipline (it seemed alright with no apparant fails)
conda create -n env_zipline python=3.5
activate env_zipline
我的消息来源看起来像这样
conda config --show-sources
(env_zipline) C:\Users\Morten>conda config --show-sources
==> C:\Users\Morten\.condarc <==
ssl_verify: True
channels:
- defaults
谁能帮我让滑索正常工作和导入
我安装的 conda 包
(env_zipline) C:\Users\Morten>conda list
# packages in environment at C:\Users\Morten\Anaconda3\envs\env_zipline:
#
# Name Version Build Channel
certifi 2018.8.24 py35_1
chardet 3.0.4 <pip>
Cython 0.28.5 <pip>
idna 2.7 <pip>
Logbook 1.4.0 <pip>
lxml 4.2.4 <pip>
numpy 1.15.1 <pip>
pandas 0.22.0 <pip>
pandas-datareader 0.6.0 <pip>
patsy 0.5.0 <pip>
pip 10.0.1 py35_0
python 3.5.6 he025d50_0
python-dateutil 2.7.3 <pip>
pytz 2018.5 <pip>
requests 2.19.1 <pip>
requests-file 1.4.3 <pip>
requests-ftp 0.3.1 <pip>
scipy 1.1.0 <pip>
setuptools 40.2.0 py35_0
six 1.11.0 <pip>
statsmodels 0.9.0 <pip>
urllib3 1.23 <pip>
vc 14 h0510ff6_3
vs2015_runtime 14.0.25123 3
wheel 0.31.1 py35_0
wincertstore 0.2 py35hfebbdb8_0
wrapt 1.10.11 <pip>
而且因为上面现在找不到滑索。我很确定我有一个环境问题,并且尝试过这个解决方案无济于事: 如何确保 Spyder 在 conda 环境中运行?
我还从 Googlegroups 尝试了这个解决方案 https://groups.google.com/forum/#!msg/spyderlib/NWGlu7r7xxo/DvfqrnF2BQAJ
C:\Users\Morten>spyder activate env_zipline
[20520:9924:0909/173803.026:ERROR:cache_util_win.cc(20)] Unable to move the cache: 5
[20520:9924:0909/173803.110:ERROR:cache_util.cc(134)] Unable to move cache folder C:\Users\Morten\AppData\Local
tWebEngine\Default\GPUCache to C:\Users\Morten\AppData\Local\Spyder\QtWebEngine\Default\old_GPUCache_000
[20520:9924:0909/173803.110:ERROR:cache_creator.cc(134)] Unable to create cache
[20520:9924:0909/173803.110:ERROR:shader_disk_cache.cc(570)] Shader Cache Creation failed: -2
但这也失败了。Spyder 打开 - 但我仍然无法导入 zipline
在 env_zipline 我确实有 zipline 文件
C:\Users\Morten\Anaconda3\envs\env_zipline\Scripts>dir
Volume in drive C is Windows10_OS
Volume Serial Number is 8FA8-3C60
Directory of C:\Users\Morten\Anaconda3\envs\env_zipline\Scripts
09-09-2018 09:51 <DIR> .
09-09-2018 09:51 <DIR> ..
26-08-2018 23:57 74 2to3-script.py
21-07-2018 03:54 40.960 2to3.exe
22-05-2017 23:57 110 alembic-script.py
22-05-2017 23:57 74.752 alembic.exe
25-07-2018 03:33 216 chardetect-script.py
21-07-2018 03:54 40.960 chardetect.exe
08-08-2018 16:44 215 cygdb-script.py
06-08-2018 20:28 40.960 cygdb.exe
08-08-2018 16:44 236 cython-script.py
06-08-2018 20:28 40.960 cython.exe
08-08-2018 16:44 216 cythonize-script.py
06-08-2018 20:28 40.960 cythonize.exe
27-08-2018 19:51 225 easy_install-script.py
21-08-2018 00:23 40.960 easy_install.exe
03-07-2018 22:51 156 f2py.bat
09-09-2018 09:48 823 f2py.py
26-08-2018 23:57 72 idle-script.py
21-07-2018 03:54 40.960 idle.exe
15-08-2018 20:18 208 mako-render-script.py
06-08-2018 20:28 40.960 mako-render.exe
20-04-2018 14:23 207 pip-script.py
16-04-2018 18:25 40.960 pip.exe
16-06-2018 10:22 215 pt2to3-script.py
15-06-2018 21:11 40.960 pt2to3.exe
16-06-2018 10:22 215 ptdump-script.py
15-06-2018 21:11 40.960 ptdump.exe
16-06-2018 10:22 217 ptrepack-script.py
15-06-2018 21:11 40.960 ptrepack.exe
16-06-2018 10:22 215 pttree-script.py
15-06-2018 21:11 40.960 pttree.exe
26-08-2018 23:57 57 pydoc-script.py
21-07-2018 03:54 40.960 pydoc.exe
15-05-2018 19:01 204 wheel-script.py
09-05-2018 00:26 40.960 wheel.exe
09-09-2018 09:50 431 zipline-script.py
17-07-2018 02:45 74.752 zipline.exe
08-09-2018 13:39 <DIR> __pycache__
36 File(s) 768.216 bytes
3 Dir(s) 86.642.364.416 bytes free
通过conda安装后无法导入zipline,我决定通过pip安装,这里出现了很多依赖错误。
Running setup.py clean for zipline
Running setup.py bdist_wheel for cyordereddict ... error
Complete output from command C:\Users\Morten\Anaconda3\envs\env_zipline\python.exe -u -c "import setuptools,
__file__='C:\\Users\\Morten\\AppData\\Local\\Temp\\pip-install-e0a7t_am\\cyordereddict\\setup.py';f=getattr(tok
pen', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdis
d C:\Users\Morten\AppData\Local\Temp\pip-wheel-pg4nv8vu --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\cyordereddict
copying python3\cyordereddict\_version.py -> build\lib.win-amd64-3.5\cyordereddict
copying python3\cyordereddict\__init__.py -> build\lib.win-amd64-3.5\cyordereddict
creating build\lib.win-amd64-3.5\cyordereddict\benchmark
copying python3\cyordereddict\benchmark\benchmark.py -> build\lib.win-amd64-3.5\cyordereddict\benchmark
copying python3\cyordereddict\benchmark\magic_timeit.py -> build\lib.win-amd64-3.5\cyordereddict\benchmark
copying python3\cyordereddict\benchmark\__init__.py -> build\lib.win-amd64-3.5\cyordereddict\benchmark
creating build\lib.win-amd64-3.5\cyordereddict\test
copying python3\cyordereddict\test\test_cyordereddict.py -> build\lib.win-amd64-3.5\cyordereddict\test
copying python3\cyordereddict\test\test_ordereddict.py -> build\lib.win-amd64-3.5\cyordereddict\test
copying python3\cyordereddict\test\_mapping_tests.py -> build\lib.win-amd64-3.5\cyordereddict\test
copying python3\cyordereddict\test\__init__.py -> build\lib.win-amd64-3.5\cyordereddict\test
running build_ext
building 'cyordereddict._cyordereddict' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visuals
rosoft.com/downloads/
----------------------------------------
Failed building wheel for cyordereddict
Running setup.py clean for cyordereddict
Running setup.py bdist_wheel for bottleneck ... error
Complete output from command C:\Users\Morten\Anaconda3\envs\env_zipline\python.exe -u -c "import setuptools,
__file__='C:\\Users\\Morten\\AppData\\Local\\Temp\\pip-install-e0a7t_am\\bottleneck\\setup.py';f=getattr(tokeni
', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_w
:\Users\Morten\AppData\Local\Temp\pip-wheel-tgb8l3w_ --python-tag cp35:
No Bottleneck unit testing available.
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\bottleneck
copying bottleneck\version.py -> build\lib.win-amd64-3.5\bottleneck
copying bottleneck\__init__.py -> build\lib.win-amd64-3.5\bottleneck
creating build\lib.win-amd64-3.5\bottleneck\benchmark
copying bottleneck\benchmark\autotimeit.py -> build\lib.win-amd64-3.5\bottleneck\benchmark
copying bottleneck\benchmark\bench.py -> build\lib.win-amd64-3.5\bottleneck\benchmark
copying bottleneck\benchmark\bench_detailed.py -> build\lib.win-amd64-3.5\bottleneck\benchmark
copying bottleneck\benchmark\__init__.py -> build\lib.win-amd64-3.5\bottleneck\benchmark
creating build\lib.win-amd64-3.5\bottleneck\slow
copying bottleneck\slow\move.py -> build\lib.win-amd64-3.5\bottleneck\slow
copying bottleneck\slow\nonreduce.py -> build\lib.win-amd64-3.5\bottleneck\slow
copying bottleneck\slow\nonreduce_axis.py -> build\lib.win-amd64-3.5\bottleneck\slow
copying bottleneck\slow\reduce.py -> build\lib.win-amd64-3.5\bottleneck\slow
copying bottleneck\slow\__init__.py -> build\lib.win-amd64-3.5\bottleneck\slow
creating build\lib.win-amd64-3.5\bottleneck\src
copying bottleneck\src\template.py -> build\lib.win-amd64-3.5\bottleneck\src
copying bottleneck\src\__init__.py -> build\lib.win-amd64-3.5\bottleneck\src
creating build\lib.win-amd64-3.5\bottleneck\tests
copying bottleneck\tests\input_modifcation_test.py -> build\lib.win-amd64-3.5\bottleneck\tests
copying bottleneck\tests\list_input_test.py -> build\lib.win-amd64-3.5\bottleneck\tests
copying bottleneck\tests\move_test.py -> build\lib.win-amd64-3.5\bottleneck\tests
copying bottleneck\tests\nonreduce_axis_test.py -> build\lib.win-amd64-3.5\bottleneck\tests
copying bottleneck\tests\nonreduce_test.py -> build\lib.win-amd64-3.5\bottleneck\tests
copying bottleneck\tests\reduce_test.py -> build\lib.win-amd64-3.5\bottleneck\tests
copying bottleneck\tests\scalar_input_test.py -> build\lib.win-amd64-3.5\bottleneck\tests
copying bottleneck\tests\util.py -> build\lib.win-amd64-3.5\bottleneck\tests
copying bottleneck\tests\__init__.py -> build\lib.win-amd64-3.5\bottleneck\tests
copying bottleneck\LICENSE -> build\lib.win-amd64-3.5\bottleneck
running build_ext
building 'bottleneck.reduce' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visuals
rosoft.com/downloads/
----------------------------------------
Failed building wheel for bottleneck
Running setup.py clean for bottleneck
Running setup.py bdist_wheel for bcolz ... error
Complete output from command C:\Users\Morten\Anaconda3\envs\env_zipline\python.exe -u -c "import setuptools,
__file__='C:\\Users\\Morten\\AppData\\Local\\Temp\\pip-install-e0a7t_am\\bcolz\\setup.py';f=getattr(tokenize, '
en)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel
rs\Morten\AppData\Local\Temp\pip-wheel-hwr_ralq --python-tag cp35:
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\bcolz
copying bcolz\arrayprint.py -> build\lib.win-amd64-3.5\bcolz
copying bcolz\attrs.py -> build\lib.win-amd64-3.5\bcolz
copying bcolz\chunked_eval.py -> build\lib.win-amd64-3.5\bcolz
copying bcolz\ctable.py -> build\lib.win-amd64-3.5\bcolz
copying bcolz\defaults.py -> build\lib.win-amd64-3.5\bcolz
copying bcolz\py2help.py -> build\lib.win-amd64-3.5\bcolz
copying bcolz\py2help_tests.py -> build\lib.win-amd64-3.5\bcolz
copying bcolz\toplevel.py -> build\lib.win-amd64-3.5\bcolz
copying bcolz\utils.py -> build\lib.win-amd64-3.5\bcolz
copying bcolz\version.py -> build\lib.win-amd64-3.5\bcolz
copying bcolz\__init__.py -> build\lib.win-amd64-3.5\bcolz
creating build\lib.win-amd64-3.5\bcolz\tests
copying bcolz\tests\all.py -> build\lib.win-amd64-3.5\bcolz\tests
copying bcolz\tests\common.py -> build\lib.win-amd64-3.5\bcolz\tests
copying bcolz\tests\test_attrs.py -> build\lib.win-amd64-3.5\bcolz\tests
copying bcolz\tests\test_carray.py -> build\lib.win-amd64-3.5\bcolz\tests
copying bcolz\tests\test_carray_objects.py -> build\lib.win-amd64-3.5\bcolz\tests
copying bcolz\tests\test_ctable.py -> build\lib.win-amd64-3.5\bcolz\tests
copying bcolz\tests\test_ndcarray.py -> build\lib.win-amd64-3.5\bcolz\tests
copying bcolz\tests\test_queries.py -> build\lib.win-amd64-3.5\bcolz\tests
copying bcolz\tests\__init__.py -> build\lib.win-amd64-3.5\bcolz\tests
copying bcolz\carray_ext.pxd -> build\lib.win-amd64-3.5\bcolz
running build_ext
skipping 'bcolz\carray_ext.c' Cython extension (up-to-date)
building 'bcolz.carray_ext' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visuals
rosoft.com/downloads/
----------------------------------------
Failed building wheel for bcolz
Running setup.py clean for bcolz
Running setup.py bdist_wheel for toolz ... done
Stored in directory: C:\Users\Morten\AppData\Local\pip\Cache\wheels\f4\0c\f6\ce6b2d1aa459ee97cc3c0f82236302bd
700219463
Running setup.py bdist_wheel for MarkupSafe ... done
Stored in directory: C:\Users\Morten\AppData\Local\pip\Cache\wheels\33\56\20\ebe49a5c612fffe1c5a632146b16596f
8661e4e46
Running setup.py bdist_wheel for Mako ... done
Stored in directory: C:\Users\Morten\AppData\Local\pip\Cache\wheels\15\35\25\dbcb848832ccb1a4b4ad23f529badfd3
17f7ca510
Running setup.py bdist_wheel for sqlalchemy ... done
Stored in directory: C:\Users\Morten\AppData\Local\pip\Cache\wheels\2b\e7\bc\03c832ebc5c8f34a4ddab35f1bc812fe
47d6af2c9
Running setup.py bdist_wheel for intervaltree ... done
Stored in directory: C:\Users\Morten\AppData\Local\pip\Cache\wheels\6b\cf\b0\f7ef2d0f504d26f3e9e70c2369e57255
d528fcbc5
Running setup.py bdist_wheel for lru-dict ... error
Complete output from command C:\Users\Morten\Anaconda3\envs\env_zipline\python.exe -u -c "import setuptools,
__file__='C:\\Users\\Morten\\AppData\\Local\\Temp\\pip-install-e0a7t_am\\lru-dict\\setup.py';f=getattr(tokenize
open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_whe
Users\Morten\AppData\Local\Temp\pip-wheel-wzw6dnx8 --python-tag cp35:
running bdist_wheel
running build
running build_ext
building 'lru' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visuals
rosoft.com/downloads/
----------------------------------------
Failed building wheel for lru-dict
Running setup.py clean for lru-dict
Running setup.py bdist_wheel for empyrical ... done
Stored in directory: C:\Users\Morten\AppData\Local\pip\Cache\wheels\83\14\73\34fb27552601518d28bd0813d75124be
152c69112
Running setup.py bdist_wheel for trading-calendars ... done
Stored in directory: C:\Users\Morten\AppData\Local\pip\Cache\wheels\ec\f9\7b\b6b1adfae7a887e281685fe8ef92f429
2937557e7
Running setup.py bdist_wheel for requests-ftp ... done
Stored in directory: C:\Users\Morten\AppData\Local\pip\Cache\wheels\2a\98\32\37195e45a3392a73d9f65c488cbea30f
ef4d6b020
Running setup.py bdist_wheel for wrapt ... done
Stored in directory: C:\Users\Morten\AppData\Local\pip\Cache\wheels\48\5d\04\22361a593e70d23b1f7746d932802efe
6a74f321e
Running setup.py bdist_wheel for python-editor ... done
Stored in directory: C:\Users\Morten\AppData\Local\pip\Cache\wheels\36\e0\98\ba386b125a00ea9dd52e2c16aa2ec0ad
bfe2e001d
Successfully built toolz MarkupSafe Mako sqlalchemy intervaltree empyrical trading-calendars requests-ftp wrapt
ditor
Failed to build zipline cyordereddict bottleneck bcolz lru-dict
Installing collected packages: Logbook, pytz, numpy, idna, urllib3, chardet, requests, six, requests-file, scip
-dateutil, pandas, requests-ftp, lxml, wrapt, pandas-datareader, patsy, statsmodels, Cython, cyordereddict, bot
contextlib2, decorator, networkx, numexpr, bcolz, click, toolz, multipledispatch, MarkupSafe, Mako, sqlalchemy,
ditor, alembic, sortedcontainers, intervaltree, lru-dict, empyrical, tables, trading-calendars, zipline
Running setup.py install for cyordereddict ... error
Complete output from command C:\Users\Morten\Anaconda3\envs\env_zipline\python.exe -u -c "import setuptools
e;__file__='C:\\Users\\Morten\\AppData\\Local\\Temp\\pip-install-e0a7t_am\\cyordereddict\\setup.py';f=getattr(t
'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" in
ecord C:\Users\Morten\AppData\Local\Temp\pip-record-m2s0wnon\install-record.txt --single-version-externally-man
mpile:
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.5
creating build\lib.win-amd64-3.5\cyordereddict
copying python3\cyordereddict\_version.py -> build\lib.win-amd64-3.5\cyordereddict
copying python3\cyordereddict\__init__.py -> build\lib.win-amd64-3.5\cyordereddict
creating build\lib.win-amd64-3.5\cyordereddict\benchmark
copying python3\cyordereddict\benchmark\benchmark.py -> build\lib.win-amd64-3.5\cyordereddict\benchmark
copying python3\cyordereddict\benchmark\magic_timeit.py -> build\lib.win-amd64-3.5\cyordereddict\benchmark
copying python3\cyordereddict\benchmark\__init__.py -> build\lib.win-amd64-3.5\cyordereddict\benchmark
creating build\lib.win-amd64-3.5\cyordereddict\test
copying python3\cyordereddict\test\test_cyordereddict.py -> build\lib.win-amd64-3.5\cyordereddict\test
copying python3\cyordereddict\test\test_ordereddict.py -> build\lib.win-amd64-3.5\cyordereddict\test
copying python3\cyordereddict\test\_mapping_tests.py -> build\lib.win-amd64-3.5\cyordereddict\test
copying python3\cyordereddict\test\__init__.py -> build\lib.win-amd64-3.5\cyordereddict\test
running build_ext
building 'cyordereddict._cyordereddict' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visua
icrosoft.com/downloads/
----------------------------------------
Command "C:\Users\Morten\Anaconda3\envs\env_zipline\python.exe -u -c "import setuptools, tokenize;__file__='C:\
orten\\AppData\\Local\\Temp\\pip-install-e0a7t_am\\cyordereddict\\setup.py';f=getattr(tokenize, 'open', open)(_
code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record C:\Users\
pData\Local\Temp\pip-record-m2s0wnon\install-record.txt --single-version-externally-managed --compile" failed w
code 1 in C:\Users\Morten\AppData\Local\Temp\pip-install-e0a7t_am\cyordereddict\
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
(env_zipline) C:\Users\Morten>pip install "Microsoft Visual C++ Build Tools"
Invalid requirement: 'Microsoft Visual C++ Build Tools'
Traceback (most recent call last):
File "C:\Users\Morten\Anaconda3\envs\env_zipline\lib\site-packages\pip\_vendor\packaging\requirements.py", li
__init__
req = REQUIREMENT.parseString(requirement_string)
File "C:\Users\Morten\Anaconda3\envs\env_zipline\lib\site-packages\pip\_vendor\pyparsing.py", line 1632, in p
g
raise exc
File "C:\Users\Morten\Anaconda3\envs\env_zipline\lib\site-packages\pip\_vendor\pyparsing.py", line 1622, in p
g
loc, tokens = self._parse( instring, 0 )
File "C:\Users\Morten\Anaconda3\envs\env_zipline\lib\site-packages\pip\_vendor\pyparsing.py", line 1379, in _
che
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "C:\Users\Morten\Anaconda3\envs\env_zipline\lib\site-packages\pip\_vendor\pyparsing.py", line 3395, in p
loc, exprtokens = e._parse( instring, loc, doActions )
File "C:\Users\Morten\Anaconda3\envs\env_zipline\lib\site-packages\pip\_vendor\pyparsing.py", line 1383, in _
che
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "C:\Users\Morten\Anaconda3\envs\env_zipline\lib\site-packages\pip\_vendor\pyparsing.py", line 3183, in p
raise ParseException(instring, loc, self.errmsg, self)
pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 10), (line:1, col:11)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Morten\Anaconda3\envs\env_zipline\lib\site-packages\pip\_internal\req\req_install.py", line 25
m_line
req = Requirement(req)
File "C:\Users\Morten\Anaconda3\envs\env_zipline\lib\site-packages\pip\_vendor\packaging\requirements.py", li
__init__
requirement_string[e.loc:e.loc + 8]))
pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'Visual C'"
我很茫然,真的需要帮助。
谁能指导我处理这些环境并让 zipline 正确导入?