复制一个Python全部环境到另一个环境

Posted 暴风城

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了复制一个Python全部环境到另一个环境相关的知识,希望对你有一定的参考价值。

导出此环境下安装的包的版本信息清单

 pip freeze > requirements.txt
 
联网,下载清单中的包到all-packet文件夹

[[email protected] ~]# pip download -d ./all-packet -r requirements.txt
Collecting cx-Oracle==6.3.1 (from -r requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/f9/b7/dbdfb56e75bbbaa39c535b38509e6a5915da03d3cff9507e15a0472de818/cx_Oracle-6.3.1-cp27-cp27m-manylinux1_x86_64.whl
Saved ./all-packet/cx_Oracle-6.3.1-cp27-cp27m-manylinux1_x86_64.whl
Collecting demjson==2.2.4 (from -r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/96/67/6db789e2533158963d4af689f961b644ddd9200615b8ce92d6cad695c65a/demjson-2.2.4.tar.gz
Saved ./all-packet/demjson-2.2.4.tar.gz
Collecting elasticsearch==5.4.0 (from -r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/0e/f2/971f07f2c9bb3744103081619b8af14fa4b366cf8bc57b80504a2cd5d36e/elasticsearch-5.4.0-py2.py3-none-any.whl (58kB)
100% |████████████████████████████████| 61kB 57kB/s
Saved ./all-packet/elasticsearch-5.4.0-py2.py3-none-any.whl
Collecting mysql-python==1.2.5 (from -r requirements.txt (line 4))
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Saved ./all-packet/MySQL-python-1.2.5.zip
Collecting numpy==1.14.3 (from -r requirements.txt (line 5))
Using cached https://files.pythonhosted.org/packages/ea/7d/9f99896cc3f4834871619a36da2a833c71a2178a5bdadd4fff40c261c119/numpy-1.14.3-cp27-cp27m-manylinux1_x86_64.whl
Saved ./all-packet/numpy-1.14.3-cp27-cp27m-manylinux1_x86_64.whl
Collecting pandas==0.23.0 (from -r requirements.txt (line 6))
Using cached https://files.pythonhosted.org/packages/45/12/1e1ba99fb65df9f7f3724d3232feef35cc044d18604d57492d561e90219f/pandas-0.23.0.tar.gz
Saved ./all-packet/pandas-0.23.0.tar.gz
Collecting progressbar==2.3 (from -r requirements.txt (line 7))
Using cached https://files.pythonhosted.org/packages/0f/e1/f30b72ecabba259c7c38dd0eb944a173effced3fd7de2c9c2902bd6f649a/progressbar-2.3.tar.gz
Saved ./all-packet/progressbar-2.3.tar.gz
Collecting python-dateutil==2.7.3 (from -r requirements.txt (line 8))
Using cached https://files.pythonhosted.org/packages/cf/f5/af2b09c957ace60dcfac112b669c45c8c97e32f94aa8b56da4c6d1682825/python_dateutil-2.7.3-py2.py3-none-any.whl
Saved ./all-packet/python_dateutil-2.7.3-py2.py3-none-any.whl
Collecting pytz==2018.4 (from -r requirements.txt (line 9))
Using cached https://files.pythonhosted.org/packages/dc/83/15f7833b70d3e067ca91467ca245bae0f6fe56ddc7451aa0dc5606b120f2/pytz-2018.4-py2.py3-none-any.whl
Saved ./all-packet/pytz-2018.4-py2.py3-none-any.whl
Collecting six==1.11.0 (from -r requirements.txt (line 10))
Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Saved ./all-packet/six-1.11.0-py2.py3-none-any.whl
Collecting urllib3==1.23 (from -r requirements.txt (line 11))
Using cached https://files.pythonhosted.org/packages/bd/c9/6fdd990019071a4a32a5e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl
Saved ./all-packet/urllib3-1.23-py2.py3-none-any.whl
Successfully downloaded cx-Oracle demjson elasticsearch MySQL-python numpy pandas progressbar python-dateutil pytz six urllib3

 

[[email protected] ~]# ls all-packet/
cx_Oracle-6.3.1-cp27-cp27m-manylinux1_x86_64.whl progressbar-2.3.tar.gz
demjson-2.2.4.tar.gz python_dateutil-2.7.3-py2.py3-none-any.whl
elasticsearch-5.4.0-py2.py3-none-any.whl pytz-2018.4-py2.py3-none-any.whl
MySQL-python-1.2.5.zip six-1.11.0-py2.py3-none-any.whl
numpy-1.14.3-cp27-cp27m-manylinux1_x86_64.whl urllib3-1.23-py2.py3-none-any.whl
pandas-0.23.0.tar.gz
[[email protected] ~]#

 

 

复制下载好的包【all-packet文件夹】和清单【requirements.txt】到其他环境

安装全部环境

pip install --no-index --find-links=./all-packet -r requirements.txt

 

以上是关于复制一个Python全部环境到另一个环境的主要内容,如果未能解决你的问题,请参考以下文章

Powershell将文件从环境变量复制到另一个环境变量的zip文件夹

将弹性 beanstalk 配置复制到另一个区域的环境中

如何将 Postgres 数据库从一个 Elastic Beanstalk 环境复制到另一个环境?我正在使用 Rails 5

:将一个CentOS环境复制到另一个CentOS

Python虚拟环境导出包安装到另一台电脑的方法

Python虚拟环境导出包安装到另一台电脑的方法