background introduction
Package the python project environment under the Linux system and perform offline installation.
Collect third-party packages and corresponding version numbers in the project
method one:
[dev@newuser env]$ pip3 freeze >requirements.txt
Method 2:
[dev@newuser env]$ pipreqs ./
To generate a requirements.txt file in the current directory.
FAQ about using pipreqs
Download third-party packages
Default installation command, specify pip source installation
[dev@newuser env]$ pip3 download -d ./packages/ -r requirements.txt -i https://pypi.douban.com/simple
Python environment packaging
Compress and package the folder where the python environment is installed (the environment installation folder is python3.6.2)
[dev@newuser env]$ tar zcvf python3.6.2.tar.gz python3.6.2
Python environment offline installation
Unzip the packaged python installation package python3.6.2.tar.gz
[dev@newuser env]$ tar zxvf python3.6.2.tar.gz
In general, most packages can be used, but for web service projects, the uwsgi package cannot be used directly, so attention should be paid.
In this case, how to install it?
Use the pip3 command to reinstall the uWSGI package (offline installation method)
[dev@newuser packages]$ pip3 install uWSGI-2.0.18.targ.gzz