Install Python Package in a Non-Internet Environment
1. Download Package
SSH to a server with Internet connection.
~$ pip install pymongo
Installing collected packages: dnspython, pymongo
Successfully installed dnspython-2.7.0 pymongo-4.10.1
~$ pip download pymongo
Saved ./pymongo-4.10.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Saved ./dnspython-2.7.0-py3-none-any.whl
Successfully downloaded pymongo dnspython
2. Transfer WHL Files to the Server
scp ubuntu@tencent:/home/ubuntu/*.whl ./
scp *.whl pan@hsbc:/home/pan/
3. Install the WHL Files
Install the WHL files in the isolated network environment.
sudo pip install *.whl
4. Troubleshooting
However I got an error message as follows:
ERROR: pymongo has an invalid wheel, pymongo has an invalid wheel, .dist-info directory 'dnspython-2.7.0.dist-info' does not start with 'pymongo'
I have fix the dependency issue.