uwsgi: invalid option -- 'x'


安装:pip install uwsgi

启动:uwsgi -x 'uwsgi.xml'
报错:uwsgi: invalid option -- 'x'

原因:centos下,在没有安装libxml2时,pip安装的uwsgi无法支持xml格式的配置文件
解决:
yum install libxml*
pip uninstall uwsgi
pip install uwsgi

有时安装libxml2后由于pip缓存编译结果,导致再次安装uwsgi仍然报该异常。
可以下载uwsgi源码包后,本地手动编译后安装即可。


下载--解压--编译--安装

  • 获取uwsgi;目前最新版本是2.0.11.1

wget http://projects.unbit.it/downloads/uwsgi-latest.tar.gz

  • 编译安装;我是用python 2.7.6 编译的

tar zxvf uwsgi-latest.tar.gz

cd uwsgi-2.0.11.1/

python uwsgiconfig.py --build

python setup.py install

  • 测试uwsgi是否正常

新建test.py:

def application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return "Hello World"

在终端运行:uwsgi --http :8001 --wsgi-file test.py

通过浏览器访问:http://:8001,看看页面是否有“Hello World”输出。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM