离线方式快速安装python模块以及相关依赖模块
一般公司的服务器都是和外网隔离的,这个如果没有内部pip源的话,想要安装python的模块就需要去python官网一个一个下载依赖模块的包,然后逐个安装,这样做非常耗时间。
我们今天用的办法就是现在我们能够连接公网的linux机器上面先使用pip命令安装好我们需要的python模块。然后再将需要的模块一键下载并拷贝到服务器上一键安装。步骤如下:
前提条件:
如果服务器是linux的,我们就需要一个能连公网的linux,不能使用windows是因为,有很多模块linux和windows两个平台不是共用的,在安装的时候会报错。
步骤:
1、在能连接公网的linux机器上使用pip命令安装好需要的模块。(pip安装的好处是:会自动帮你把依赖模块安装好)
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ sh
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ docker-py
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ fabric
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ paramiko
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ psutil
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ PyMySQL
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ redis
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ requests
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ selenium
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ SQLAlchemy
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ tornado
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ xlrd
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ xlwt
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ xmltodict
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ celery
pip3 install -i https://mirrors.aliyun.com/pypi/simple/ celery-flower
2、然后在能连接公网的机器上执行pip freeze>python3_module.txt,这样就可以将你之前安装的模块列表导出来
3、列表导出来以后就需要根据这个列表去把模块的代码文件从公网下载下来,执行mkdir python3_package && pip3 download -r python3_modules.txt -d python3_packages/ -i https://mirrors.aliyun.com/pypi/simple/ ,这里我们使用了阿里的源,这样下载的速度会快很多
4、将下载完的文件夹打包,mv python3_modules.txt python3_packages/ && tar -czf python3_packages.tar.gz python3_packages,然后将打包完的文件上传到服务器上解压,tar -xzf python3_packages.tar.gz。
5、在服务器上安装我们的模块(前提需要安装和能连接公网的linux机器版本相同的python),cd python3_packages && /opt/samp/venv/python3/bin/pip3 install --no-index --find-links=file:. -r python3_modules.txt,等待安装完成即可,这样可以避免让人奔溃的依赖模块一个一个安装问题。
[root@itsasitapp213 python3_packages]# /opt/samp/venv/python3/bin/pip3 install --no-index --find-links=file:. -r python3_modules.txt
Looking in links: file:.
Collecting amqp==2.4. (from -r python3_modules.txt (line ))
Collecting asn1crypto==0.24. (from -r python3_modules.txt (line ))
Collecting Babel==2.6. (from -r python3_modules.txt (line ))
Collecting bcrypt==3.1. (from -r python3_modules.txt (line ))
Collecting billiard==3.5.0.5 (from -r python3_modules.txt (line ))
Collecting celery==4.2. (from -r python3_modules.txt (line ))
Collecting celery-flower==1.0. (from -r python3_modules.txt (line ))
Collecting certifi==2018.11. (from -r python3_modules.txt (line ))
Collecting cffi==1.12. (from -r python3_modules.txt (line ))
Collecting chardet==3.0. (from -r python3_modules.txt (line ))
Collecting cryptography==2.6. (from -r python3_modules.txt (line ))
Collecting docker-py==1.10. (from -r python3_modules.txt (line ))
Collecting docker-pycreds==0.4. (from -r python3_modules.txt (line ))
Collecting fabric==2.4. (from -r python3_modules.txt (line ))
Collecting idna==2.8 (from -r python3_modules.txt (line ))
Collecting invoke==1.2. (from -r python3_modules.txt (line ))
Collecting kombu==4.4. (from -r python3_modules.txt (line ))
Collecting paramiko==2.4. (from -r python3_modules.txt (line ))
Collecting psutil==5.6. (from -r python3_modules.txt (line ))
Collecting pyasn1==0.4. (from -r python3_modules.txt (line ))
Collecting pycparser==2.19 (from -r python3_modules.txt (line ))
Collecting PyMySQL==0.9. (from -r python3_modules.txt (line ))
Collecting PyNaCl==1.3. (from -r python3_modules.txt (line ))
Collecting pytz==2018.9 (from -r python3_modules.txt (line ))
Collecting redis==3.2. (from -r python3_modules.txt (line ))
Collecting requests==2.21. (from -r python3_modules.txt (line ))
Collecting selenium==3.141. (from -r python3_modules.txt (line ))
Collecting sh==1.12. (from -r python3_modules.txt (line ))
Collecting six==1.12. (from -r python3_modules.txt (line ))
Collecting SQLAlchemy==1.3. (from -r python3_modules.txt (line ))
Collecting tornado==6.0. (from -r python3_modules.txt (line ))
Collecting urllib3==1.24. (from -r python3_modules.txt (line ))
Collecting vine==1.2. (from -r python3_modules.txt (line ))
Collecting websocket-client==0.55. (from -r python3_modules.txt (line ))
Collecting xlrd==1.2. (from -r python3_modules.txt (line ))
Collecting xlwt==1.3. (from -r python3_modules.txt (line ))
Collecting xmltodict==0.12. (from -r python3_modules.txt (line ))
Installing collected packages: vine, amqp, asn1crypto, pytz, Babel, six, pycparser, cffi, bcrypt, billiard, kombu, celery, tornado, celery-flower, certifi, chardet, cryptography, websocket-client, docker-pycreds, urllib3, idna, requests, docker-py, invoke, pyasn1, PyNaCl, paramiko, fabric, psutil, PyMySQL, redis, selenium, sh, SQLAlchemy, xlrd, xlwt, xmltodict
Running setup.py install for pycparser ... done
Running setup.py install for billiard ... done
Running setup.py install for tornado ... done
Running setup.py install for celery-flower ... done
Running setup.py install for psutil ... done
Running setup.py install for SQLAlchemy ... done
Successfully installed Babel-2.6. PyMySQL-0.9. PyNaCl-1.3. SQLAlchemy-1.3. amqp-2.4. asn1crypto-0.24. bcrypt-3.1. billiard-3.5.0.5 celery-4.2. celery-flower-1.0. certifi-2018.11. cffi-1.12. chardet-3.0. cryptography-2.6. docker-py-1.10. docker-pycreds-0.4. fabric-2.4. idna-2.8 invoke-1.2. kombu-4.4. paramiko-2.4. psutil-5.6. pyasn1-0.4. pycparser-2.19 pytz-2018.9 redis-3.2. requests-2.21. selenium-3.141. sh-1.12. six-1.12. tornado-6.0. urllib3-1.24. vine-1.2. websocket-client-0.55. xlrd-1.2. xlwt-1.3. xmltodict-0.12.
离线方式快速安装python模块以及相关依赖模块的更多相关文章
- 在Ubuntu上使用离线方式快速安装K8S v1.11.1
在Ubuntu上使用离线方式快速安装K8S v1.11.1 0.安装包文件下载 https://pan.baidu.com/s/1nmC94Uh-lIl0slLFeA1-qw v1.11.1 文件大小 ...
- 第三百二十三节,web爬虫,scrapy模块以及相关依赖模块安装
第三百二十三节,web爬虫,scrapy模块以及相关依赖模块安装 当前环境python3.5 ,windows10系统 Linux系统安装 在线安装,会自动安装scrapy模块以及相关依赖模块 pip ...
- 二 web爬虫,scrapy模块以及相关依赖模块安装
当前环境python3.5 ,windows10系统 Linux系统安装 在线安装,会自动安装scrapy模块以及相关依赖模块 pip install Scrapy 手动源码安装,比较麻烦要自己手动安 ...
- 二进制方式快速安装MySQL数据库命令集合
二进制方式快速安装MySQL数据库命令集合 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 1.安装mysql ls mysql ...
- CentOS RDO方式快速安装OpenStack
一.了解RDO RDO是什么? RDO是红帽Red Hat Enterprise Linux OpenStack Platform的社区版,类似RHEL和Fedora,RHEV和oVirt这样的关系. ...
- Windows安装Python图像处理库:PIL模块
平常一般都在Linux下用Python,今天女票突然说让帮忙把一些图片全部弄成一个分辨率的,作为程序员,这种重复的工作还是交给计算机吧. 废话不多说,打开Cmd看下Windows的python下面是否 ...
- CentOS 7 yum方式快速安装MongoDB
一.安装环境及配置yum # more /etc/redhat-release CentOS Linux release 7.2.1511 (Core) # vi /etc/yum.repos.d/m ...
- Linux - CentOS 7 yum方式快速安装MongoDB
一.安装环境及配置yum # more /etc/redhat-release CentOS Linux release 7.2.1511 (Core) # vi /etc/yum.repos.d/m ...
- PHP安装扩展mcrypt以及相关依赖项 【PHP安装PECL扩展的方法】
一:Mcrypt简介 Mcrypt是PHP的一个扩展,完成了常用加密算法的封装.其实该扩展是对mcrypt标准类库的封装,mcrypt完成了相当多的常用加密算法,如DES, TripleDES, Bl ...
随机推荐
- vue+element省市县的二级联动功能
项目中有选择省市县的需求,先选择省,再选择县 解决这个需求也不是很难,总体思路就是看后端接口, 一般后端接口都是请求参数为 0 返回省的数据,不为 0 的话返回相对应的市的数据 template代码: ...
- Fortify漏洞之Portability Flaw: File Separator 和 Poor Error Handling: Return Inside Finally
继续对Fortify的漏洞进行总结,本篇主要针对 Portability Flaw: File Separator 和 Poor Error Handling: Return Inside Fina ...
- iOS 原生推送(APNS)的实现
1.前期准备工作 创建你的APNs keys 或者 创建推送证书,这两个创建一个即可实现推送.这两个创建一个即可实现推送.这两个创建一个即可实现推送.重要的事情说三遍,我看评论区有小伙伴误解. 1. ...
- 【Tomcat】安装Tomcat服务器&Tomcat的目录结构
创建时间:6.14 一.安装Tomcat服务器 Tomcat下载ver8的,现在用的多 下载并解压 配置环境变量:(切记!!不然startup那步会闪退) 1.新建系统环境变量: (1)进入根目录,复 ...
- 大数据技术原理与应用【第五讲】NoSQL数据库:5.1 NoSQL概论&5.2 NoSQL与关系数据库的比较
5.1 NoSQL概论 最初:反SQL 概念演变,现在:Not only SQL 特点: 1.灵活的可扩展性 所以支持海量数据存储 2.灵活的数据模型 例如:HBase 3.和云计算的紧密结合 (一) ...
- clickjacking 攻击
文章:Web安全之点击劫持(ClickJacking) 点击劫持(ClickJacking)是一种视觉上的欺骗手段.大概有两种方式,一是攻击者使用一个透明的iframe,覆盖在一个网页上,然后诱使用户 ...
- gradle应用
官网下载 http://services.gradle.org/distributions/ 解压并配置环境 1.解压gradle到你想要的目录 2.配置环境变量 GRADLE_HOME=D:\gra ...
- python基础语法15 面向对象2 继承,多态,继承json模块中JSONEncoder,并派生出新的功能
继承 1.什么是继承? 继承是一种新建类的方式,新建的类称之为子类或派生类,继承的父类称之为基类或超类. - 在Python中,一个子类可以继承多个父类.(面试可能会问) - 在其它语言中,一个子类只 ...
- GIL全局解释器锁及协程
GIL全局解释器锁 1.什么是GIL全局解释器锁 GIL本质是一把互斥锁,相当于执行权限,每个进程内都会存在一把GIL同一进程内的多线程,必须抢到GIL之后才能使用Cpython解释器来执行自己的代码 ...
- MyBatisSystemException 【exception】
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: ...