量化环境配置

2019-02-16  本文已影响0人  小驴Donkey

先切换pip源

修改或创建~/.pip/pip.conf
添加内容

[global]
index-url = https://pypi.douban.com/simple

Anaconda安装

从这里下载归档的anaconda安装包,安装后按照说明配置清华源
https://mirror.tuna.tsinghua.edu.cn/help/anaconda/

安装配置privoxy

sudo apt install privoxy

打开/etc/privoxy/config文件,找到下面两处地方添加红框中的内容。


privoxy-listen.png privoxy-forwarding.png

重启privoxy

service privoxy restart

创建conda环境

conda create -n quant

ta-lib安装

先设置http代理

http_proxy=http://localhost:8118
https_proxy=http://localhost:8118

然后

conda install -c Quantopian ta-lib

要设置proxy的原因是ta-lib的源在anaconda的服务器,在国内访问不稳定,经常下载失败,通过proxy访问好很多。
安装完了取消掉proxy设置,以免影响后面的正常访问。

unset http_proxy
unset https_proxy

安装bcolz和line_profiler

这两个包通过pip安装是源码安装,可能会编译失败,通过conda安装是编译过的二进制包,肯定不会失败。

conda install bcolz line_profiler

rqalpha安装

pip install rqalpha
rqalpha version
rqalpha update-bundle
rqalpha examples

https://rqalpha.readthedocs.io/zh_CN/latest/intro/detail_install.html

tushare安装

pip install bs4
pip install tushare

Notebook里添加Anaconda环境

注册kernel

pip install ipykernel
sudo /home目录/anaconda目录/envs/环境名/bin/python -m ipykernel install --name 环境名

上一篇 下一篇

猜你喜欢

热点阅读