如何把外网python虚拟环境迁移到内网
外网python2.7虚拟环境中安装了flask模块,期望在内网使用,如何迁移外网的虚拟环境到内网呢?
1进入外网python虚拟环境
[root@localhost20200422]#sourcepython27_virtual_env/bin/activate
(python27_virtual_env)[root@localhost20200422]#
2导入虚拟环境中已安装包的信息到requirements.txt文件中
(python27_virtual_env)[root@localhost20200422]#pipfreeze--all>requirements.txt
3创建一个临时目录,将安装包下载到该目录下
(python27_virtual_env)[root@localhost20200422]#mkdirwhls
(python27_virtual_env)[root@localhost20200422]#cdwhls
(python27_virtual_env)[root@localhostwhls]#pipdownload-r../requirements.txt-d.
(python27_virtual_env)[root@localhostwhls]#ll
total4368
-rw-r--r--.1rootroot6790May1412:16atomicwrites-1.4.0-py2.py3-none-any.whl
-rw-r--r--.1rootroot39472May1412:16attrs-19.3.0-py2.py3-none-any.whl
-rw-r--r--.1rootroot5670May1412:16backports.functools_lru_cache-1.6.1-py2.py3-none-any.whl
-rw-r--r--.1rootroot109519May1412:16beautifulsoup4-4.9.0-py2-none-any.whl
-rw-r--r--.1rootroot157007May1412:16certifi-2020.4.5.1-py2.py3-none-any.whl
-rw-r--r--.1rootroot133356May1412:16chardet-3.0.4-py2.py3-none-any.whl
-rw-r--r--.1rootroot82780May1412:16click-7.1.2-py2.py3-none-any.whl
-rw-r--r--.1rootroot22828May1412:16configparser-4.0.2-py2.py3-none-any.whl
-rw-r--r--.1rootroot9770May1412:16contextlib2-0.6.0.post1-py2.py3-none-any.whl
-rw-r--r--.1rootroot94570May1412:16Flask-1.1.2-py2.py3-none-any.whl
-rw-r--r--.1rootroot17697May1412:16funcsigs-1.0.2-py2.py3-none-any.whl
-rw-r--r--.1rootroot58388May1412:16idna-2.9-py2.py3-none-any.whl
-rw-r--r--.1rootroot30763May1412:16importlib_metadata-1.6.0-py2.py3-none-any.whl
-rw-r--r--.1rootroot16743May1412:16itsdangerous-1.1.0-py2.py3-none-any.whl
-rw-r--r--.1rootroot125774May1412:16Jinja2-2.11.2-py2.py3-none-any.whl
-rw-r--r--.1rootroot24348May1412:16MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
-rw-r--r--.1rootroot52303May1412:16more_itertools-5.0.0-py2-none-any.whl
-rw-r--r--.1rootroot37090May1412:16packaging-20.3-py2.py3-none-any.whl
-rw-r--r--.1rootroot18252May1412:16pathlib2-2.3.5-py2.py3-none-any.whl
-rw-r--r--.1rootroot1489786May1412:16pip-20.1-py2.py3-none-any.whl
-rw-r--r--.1rootroot18077May1412:16pluggy-0.13.1-py2.py3-none-any.whl
-rw-r--r--.1rootroot83824May1412:16py-1.8.1-py2.py3-none-any.whl
-rw-r--r--.1rootroot67842May1412:16pyparsing-2.4.7-py2.py3-none-any.whl
-rw-r--r--.1rootroot231581May1412:16pytest-4.6.10-py2.py3-none-any.whl
-rw-r--r--.1rootroot269377May1412:16PyYAML-5.3.1.tar.gz
-rw-r--r--.1rootroot58406May1412:16requests-2.23.0-py2.py3-none-any.whl
-rw-r--r--.1rootroot33311May1412:16scandir-1.10.0.tar.gz
-rw-r--r--.1rootroot583351May1412:16setuptools-44.1.0-py2.py3-none-any.whl
-rw-r--r--.1rootroot10938May1412:16six-1.14.0-py2.py3-none-any.whl
-rw-r--r--.1rootroot33516May1412:16soupsieve-1.9.5-py2.py3-none-any.whl
-rw-r--r--.1rootroot126746May1412:16urllib3-1.25.9-py2.py3-none-any.whl
-rw-r--r--.1rootroot19410May1412:16wcwidth-0.1.9-py2.py3-none-any.whl
-rw-r--r--.1rootroot298631May1412:16Werkzeug-1.0.1-py2.py3-none-any.whl
-rw-r--r--.1rootroot26502May1412:16wheel-0.34.2-py2.py3-none-any.whl
-rw-r--r--.1rootroot4821May1412:16zipp-1.2.0-py2.py3-none-any.whl
4将创建好的虚拟环境打包,拷贝到新的环境中
5解压,激活该虚拟环境
6将whls目录拷贝解压到新环境的目录下
7执行安装命令安装
pipinstall--no-index--find-links=your_offline_packages-rrequirements.txt
8详细迁移方法参考
https://www.nhooo.com/article/153980.htm
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持毛票票。