亲宝软件园·资讯

展开

Python 离线工作环境搭建的方法步骤

人气:0

准备

在断网的和联网的机器安装pip,下载地址http://pypi.python.org/pypi/pip

在联网的开发机器上安装好需要的包

例如:

pip3 install paramiko
pip3 install fabric

打包已安装的包

新建pyenv文件夹用来存储下载下来的所需安装包

pip3 list #查看安装的包

#使用pip导出当前环境所有依赖包信息文件
pip3 freeze >requirements.txt

# 下载所有依赖包到本地
pip3 install -r requirements.txt -d /root/pyenv/

# pip10使用
pip download -d C:\Users\pyenv -r requirements.txt 

在其他环境下(相同的系统环境)安装所有依赖

$ pip install --no-index --find-links=/home/pyenv -r requirements.txt

Collecting asn1crypto==0.24.0 (from -r requirements.txt (line 1))
Collecting bcrypt==3.1.4 (from -r requirements.txt (line 2))
Collecting certifi==2018.4.16 (from -r requirements.txt (line 3))
Collecting cffi==1.11.5 (from -r requirements.txt (line 4))
Collecting chardet==3.0.4 (from -r requirements.txt (line 5))
Collecting cryptography==2.2.2 (from -r requirements.txt (line 6))
Requirement already satisfied: fabric==2.0.1 in /home/ap/tscms/anaconda3/lib/python3.6/site-packages/fabric-2.0.1-py3.6.egg (from -r requirements.txt (line 7))

查看已经安装的包

pip freeze
您可能感兴趣的文章:

加载全部内容

相关教程
猜你喜欢
用户评论