Linux系统版本: SLES12sp3 (阿里云)
1. 首先需要安装python-devel,否则后续安装会报错!
rpm -qa|grep python-base
结果:
python-base-2.7.13-27.1.x86_64
根据以上结果,需要安装对应版本的python-deve:
python-devel-2.7.13-27.1.x86_64.rpm
下载地址:
wget --no-check-certificate https://104.45.147.201/repo/SUSE/Updates/SLE-SDK/12-SP2/x86_64/update/x86_64/python-devel-2.7.13-27.1.x86_64.rpm
下载后使用rpm -ivh命令安装即可;
2. 安装virtualenv
pip install virtualenv
3. 创建python项目文件夹并激活
mkdir /var/www/python
cd /var/www/python
virtualenv sunlight
source sunlight/bin/activate
4. 安装uwsgi+Flask:
pip install uwsgi
pip install Flask
(使用pip命令安装Flask,只是安装了几个基本插件,如需要连接Mysql,Mongodb,还需要执行以下命令:)
pip install flask-mysql
pip install flask-sqlalchemy
(连接Mysql,以上二选一)
pip install Flask-PyMongo
参考: https://www.cnblogs.com/Ray-liang/p/4173923.html