Zipline import error. No module named zipline.tran

2019-04-11 10:26发布

I am not able to import the zipline.transforms module

>>> from zipline.transforms import batch_transform
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'zipline.transforms'

2条回答
劫难
2楼-- · 2019-04-11 10:53

I think you should firstly print out your sys.path (print sys.path), and then see where you zipline module is installed (somewhere like .../lib/python2.7/site-packages/zipline). Usually "no module named XXX" is caused by you sys.path doesn't contain the path you installed zipline. You should just add your zipline path into sys.path. Also use anaconda is good for zipline (http://www.zipline.io/install.html), so as to keep the environment tidy and clean.

查看更多
混吃等死
3楼-- · 2019-04-11 11:07

Disclaimer: I'm currently a maintainer of Zipline.

I'm guessing the reason you're seeing this error is because that particular module was removed a while back (assuming you're using zipline 1.0.0 or later). If you want to do things similar to transforms you'll need to call data.history() to get your pricing data, and call numpy/pandas functions like .avg() or .std(), or use talib.

查看更多
登录 后发表回答