flask offline installation to linux server

Recently, a small subsystem was rewritten with flask. After local testing, I want to deploy it to a remote server. However, since the server cannot connect to the external network and flask is not installed, we have to say goodbye to the convenient and quick pip install flask. Now record the steps of offline installation of flask as follows for memo.

1. Download the flask installation package

On PyPI The Python Package Index (all the following installation packages can be found and downloaded at this URL), find the flask installation package, choose to download flask-1.1.1, and check the setup in Flask-1.1.1.tar.gz. py:

Lines 51-57 of setup.py in Flask-1.1.1.tar.gz

It can be found that the python environment required by flask-1.1.1 is python2.7 and above, or python3.5 and above ; the dependent installation packages required for installation include Werkzeug, Jinjia2, itsdangerous, and click , and each dependent installation package version is required.

2. Meet the needs of flask installation

Since the python environment of the server is python2.7 and python3.4, and the code is written in python3, I decided to install python3.6 offline, so I downloaded Python-3.6.1.tgz. In addition, Werkzeug-1.0.0.tar.gz, Jinja2-2.11.1.tar.gz, itsdangerous-1.1.0.tar.gz, Click-7.0.tar.gz were downloaded in sequence.

Check the setup.py in it and find that: Jinja2-2.11.1 requires two dependent installation packages MarkupSafe >= 0.23 and Babel >= 0.8, so I downloaded MarkupSafe-1.1.1.tar.gz and Babel-2.8.0. tar.gz. Among them, Babel-2.8.0 depends on pytz >= 2015.7, download pytz-2019.3.tar.gz.

The final downloaded installation package is as follows:

All installation packages

The dependencies between the installation packages are as follows:

Dependencies between installation packages

3. Install in sequence according to dependencies

(1)python

#tar -xvzf Python-3.6.1.tgz

#cd Python-3.6.1/

#./configure

#sudo make altinstall

(2)Tool

#tar -xzvf tool-1.0.0.tar.gz

#cd tool-1.0.0/

#sudo python3.6 setup.py install

(3)MarkupSafe

#tar -xzvf MarkupSafe-1.1.1.tar.gz

#cd MarkupSafe-1.1.1/

#sudo python3.6 setup.py install

(4)pytz

#tar -xzvf pytz-2019.3.tar.gz

#cd pytz-2019.3/

#sudo python3.6 setup.py install

(5)Babel

#tar -xzvf Babel-2.8.0.tar.gz

#cd Babel-2.8.0/

#sudo python3.6 setup.py install

(6)Jinja2

#tar -xzvf Jinja2-2.11.1.tar.gz

#cd Jinja2-2.11.1/

#sudo python3.6 setup.py install

(7)itsdangerous

#tar -xzvf itsdangerous-1.1.0.tar.gz

#cd itsdangerous-1.1.0/

#sudo python3.6 setup.py install

(8)Click

#tar -xzvf Click-7.0.tar.gz

#cd Click-7.0/

#sudo python3.6 setup.py install

(9)Flask

#tar -xzvf Flask-1.1.1.tar.gz

#cd Flask-1.1.1/

#sudo python3.6 setup.py install

This completes the installation. 

Guess you like

Origin blog.csdn.net/baidu_40395808/article/details/104657444