python打包环境配置

2019-03-26  本文已影响0人  Cat丹

安装conda

conda加清华源

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes

requirements.txt用来记录项目所有的依赖包和版本号,只需要一个简单的pip命令就能完成。

pip freeze >requirements.txt

然后就可以用
pip install -r requirements.txt

conda基础

# 查看该环境中包和其版本的列表:
conda list
# 列出环境
conda info -e

conda create -n py35 python=3.5出错

If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
这可能是防火墙问题,使用命令
conda config --set ssl_verify false
# 创建打包环境
conda create -n py35 python=3.5

# 进入打包
source activate py35

# 打包
python xxx.setup bdist_wheel

# 退出打包环境
source deactivate py35

# 创建测试环境
conda create -n test35 python=3.5

# 进入测试环境
source activate test35

# 测试打出的包能否正确安装
pip install xxx.whl
python -c "import xxx"
上一篇 下一篇

猜你喜欢

热点阅读