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

yipeiwu_com7年前Python基础

准备

在断网的和联网的机器安装pip,下载地址https://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

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

python通过百度地图API获取某地址的经纬度详解

python通过百度地图API获取某地址的经纬度详解

前言 这几天比较空闲,就接触了下百度地图的API(开发者中心链接地址:http://developer.baidu.com/),发现调用还是挺方便的,本文将给大家详细的介绍关于pytho...

Python实现提取文章摘要的方法

本文实例讲述了Python实现提取文章摘要的方法。分享给大家供大家参考。具体如下: 一、概述 在博客系统的文章列表中,为了更有效地呈现文章内容,从而让读者更有针对性地选择阅读,通常会同时...

简单了解python高阶函数map/reduce

简单了解python高阶函数map/reduce

高阶函数map/reduce Python内建了map()和reduce()函数。 我们先看map。map()函数接收两个参数,一个是函数,一个是Iterable,map将传入的函数...

python使用百度翻译进行中翻英示例

利用百度词典进行中翻英 复制代码 代码如下:import urllib2import reimport sys reload(sys)sys.setdefaultencoding('ut...

Python绑定方法与非绑定方法详解

本文实例为大家分享了Python绑定方法与非绑定方法,供大家参考,具体内容如下 定义: 绑定方法(绑定给谁,谁来调用就自动将它本身当作第一个参数传入):     1. 绑定到类的方法:用...