测试环境:linux centos7下
1、安装uwsgi
python3下安装:
pip3 install uwsgi
python2下安装:
pip install uwsgi
如果是系统自带的python2.7环境下安装的话,有可能会出错:
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-
jjOBXy/uwsgi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-3cX7u0-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-jjOBXy/uwsgi/
这时候需要我们先安装一个python开发包:
yum install -y python-devel
然后就可以安装了
2、测试 uwsgi
#python 3.x def application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return [b"Hello World"] #Python 3.x 需要 返回字节字符串 #python 2.x #def application(env, start_response): # start_response('200 OK', [('Content-Type','text/html')]) # return ["Hello World"]