python 虚拟环境移植
Background
- VM1已安装项目用各种Package,VM2也想搭建同样的环境(python 3.7 x64)
Step
1. Collect all package information from VM1, run the following command. Suppose current work dir is whls
pip freeze --all >requirements.txt
--all: setuptools and urllib3 etc. will be collected to requirements.txt
download whl files for VM1(Use when VM2 has no network)
pip download -r requirements.txt
if download successfully, will find them under whls folder.
2. VM2 install the above packages.
With network, you can run the below command to install
pip install -r requirements.txt
When you do not have network, run the below command, will use the downloaded whl files.
pip install --no-index --find-index=. -r requirements.txt
.means current path, pip install -h see the detail information for install
BTW, we use the version of pip is 21.3.1, you should upgrade pip if your version is 10.0.1
浙公网安备 33010602011771号