美文网首页
python打包环境配置

python打包环境配置

作者: Cat丹 | 来源:发表于2019-03-26 17:21 被阅读0次

安装conda

  • 下载.sh文件
  • chmod 777 *.sh,修改文件权限
  • sudo *.sh安装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"

相关文章

网友评论

      本文标题:python打包环境配置

      本文链接:https://www.haomeiwen.com/subject/zvjnvqtx.html