离线方式快速安装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 ...
随机推荐
- APP手势密码绕过
之前写的文章收到了很多的好评,主要就是帮助到了大家学习到了新的思路.自从发布了第一篇文章,我就开始筹备第二篇文章了,最终打算在07v8首发,这篇文章我可以保障大家能够学习到很多思路.之前想准备例子视频 ...
- SpringBoot学习笔记:http接口请求
controller package com.example.demo.controller; import java.util.HashMap; import java.util.Map; impo ...
- pymysql操作(老版本的,新版有基础不同)
导入库 import pymysql 创建链接 conn=pymysql.connect(host='127.0.0.1',port='3306',user='root',passwd='123456 ...
- LAMP架构性能测试+php优化
性能测试:1. 首先查看一下服务器的硬件性能free -m ---->查看一下内存的情况lscpu或者cat /proc/cpuinfo ------à查看一下cpu的情况2. ...
- Godaddy ssl证书配置到nginx
打开终端,输入以下命令 openssl req -new -newkey rsa:2048 -nodes -keyout domain.key -out domain.csr 生成过程会询问几个常见问 ...
- gradle应用
官网下载 http://services.gradle.org/distributions/ 解压并配置环境 1.解压gradle到你想要的目录 2.配置环境变量 GRADLE_HOME=D:\gra ...
- MyISAM引擎mysql5.6中大型网站数据库优化配置方案
硬件服务器:Dell R710,双至强E5620 CPU.16G内存.6*500G硬盘 操作系统:CentOS5.5 X86_64 系统 Mysql版本:MySQL 5.6 适用于:日IP ...
- acwing 算法面试、笔试题公开课整理记录
week1 Google KickStart 2019 A轮 讲解视频地址AcWing 549. 训练 tag: 排序 遍历 在线练习地址AcWing 550. 包裹 在线练习地址Ac ...
- 每天一道Rust-LeetCode(2019-06-01)
每天一道Rust-LeetCode(2019-06-01) 坚持每天一道题,刷题学习Rust. 题目描述 给出两个 非空 的链表用来表示两个非负的整数.其中,它们各自的位数是按照 逆序 的方式存储的, ...
- selenium数据读取模块
例如 数据保存在txt中 def info(path): web_info={} config = open(path) for line in config: result = [ele.strip ...