2

我今天按照使用 Conda ( https://github.com/quantopian/zipline ) 在 Quantopian 的说明安装了“Zipline”。

您能否帮助我解决以下问题或简单地解释如何回滚到原始状态。我需要熊猫!

Python2:无法运行 Pandas 并出现以下错误:

Python 2.7.13 |Anaconda custom (64-bit)| (default, Dec 19 2016, 13:29:36) [MSC v.1500 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.



import pandas
Traceback (most recent call last):

  File "<ipython-input-1-d6ac987968b6>", line 1, in <module>
    import pandas

  File "C:\Users\Bhushan\Anaconda2\lib\site-packages\pandas\__init__.py", line 13, in <module>
    "extensions first.".format(module))

ImportError: C extension: hashtable not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.

Python3: 无法运行试点程序 (QuickStart) 并出现以下错误:

D:\.....\zipline>zipline run -f dual_moving_average.py --start 2011-1-1 --end 2012-1-1 -o dma.pickle
c:\users\bhushan\anaconda3\lib\site-packages\pandas\tseries\index.py:755: PerformanceWarning: Non-vectorized DateOffset being applied to Series or DatetimeIndex
  PerformanceWarning)
c:\users\bhushan\anaconda3\lib\site-packages\pandas\tseries\index.py:755: PerformanceWarning: Non-vectorized DateOffset being applied to Series or DatetimeIndex
  PerformanceWarning)
c:\users\bhushan\anaconda3\lib\site-packages\pandas\tseries\index.py:755: PerformanceWarning: Non-vectorized DateOffset being applied to Series or DatetimeIndex
  PerformanceWarning)
[2017-05-21 14:30:36.803435] INFO: Loader: Cache at C:\Users\Bhushan/.zipline\data\^GSPC_benchmark.csv does not have data from 1990-01-02 00:00:00+00:00 to 2017-05-17 00:00:00+00:00.
Downloading benchmark data for '^GSPC'.
[2017-05-21 14:30:38.754860] ERROR: Loader: failed to cache the new benchmark returns
Traceback (most recent call last):
  File "c:\users\bhushan\anaconda3\lib\site-packages\zipline\data\loader.py", line 248, in ensure_benchmark_data
    last_date,
  File "c:\users\bhushan\anaconda3\lib\site-packages\zipline\data\benchmarks.py", line 59, in get_benchmark_returns
    squeeze=True,  # squeeze tells pandas to make this a Series
  File "c:\users\bhushan\anaconda3\lib\site-packages\pandas\io\parsers.py", line 498, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "c:\users\bhushan\anaconda3\lib\site-packages\pandas\io\parsers.py", line 262, in _read
    compression=kwds.get('compression', None))
  File "c:\users\bhushan\anaconda3\lib\site-packages\pandas\io\common.py", line 258, in get_filepath_or_buffer
    req = _urlopen(str(filepath_or_buffer))
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 163, in urlopen
    return opener.open(url, data, timeout)
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 472, in open
    response = meth(req, response)
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 504, in error
    result = self._call_chain(*args)
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 444, in _call_chain
    result = func(*args)
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 696, in http_error_302
    return self.parent.open(new, timeout=req.timeout)
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 472, in open
    response = meth(req, response)
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 582, in http_response
    'http', request, response, code, msg, hdrs)
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 510, in error
    return self._call_chain(*args)
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 444, in _call_chain
    result = func(*args)
  File "c:\users\bhushan\anaconda3\lib\urllib\request.py", line 590, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 502: Connection refused
Traceback (most recent call last):
  File "c:\users\bhushan\anaconda3\lib\runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\bhushan\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Bhushan\Anaconda3\Scripts\zipline.exe\__main__.py", line 9, in <module>
  File "c:\users\bhushan\anaconda3\lib\site-packages\click\core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\bhushan\anaconda3\lib\site-packages\click\core.py", line 696, in main
    rv = self.invoke(ctx)
  File "c:\users\bhushan\anaconda3\lib\site-packages\click\core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\bhushan\anaconda3\lib\site-packages\click\core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\bhushan\anaconda3\lib\site-packages\click\core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "c:\users\bhushan\anaconda3\lib\site-packages\zipline\__main__.py", line 97, in _
    return f(*args, **kwargs)
  File "c:\users\bhushan\anaconda3\lib\site-packages\click\decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "c:\users\bhushan\anaconda3\lib\site-packages\zipline\__main__.py", line 240, in run
    environ=os.environ,
  File "c:\users\bhushan\anaconda3\lib\site-packages\zipline\utils\run_algo.py", line 132, in _run
    env = TradingEnvironment(asset_db_path=connstr)
  File "c:\users\bhushan\anaconda3\lib\site-packages\zipline\finance\trading.py", line 96, in __init__
    self.bm_symbol,
  File "c:\users\bhushan\anaconda3\lib\site-packages\zipline\data\loader.py", line 165, in load_market_data
    trading_day,
  File "c:\users\bhushan\anaconda3\lib\site-packages\zipline\data\loader.py", line 253, in ensure_benchmark_data
    if not has_data_for_dates(data, first_date, last_date):
UnboundLocalError: local variable 'data' referenced before assignment
4

0 回答 0