ubuntu16安装uwsgi
先说解决办法:1、python的版本用3.8;2、gcc降级,教程如:https://blog.csdn.net/haojie_duan/article/details/124143322,https://blog.csdn.net/feinifi/article/details/121793945;3、用pip安装uwsgi,别用apt安装。
我的环境是python3.9,首先用pip install uwsgi安装时提示报错,安装不上,后面用apt install uwsgi 安装成功了,此时uwsgi的版本是2.0.20 debain。然后我用uwsgi --ini xxx.ini启动时报错,具体报错如下:
*** Starting uWSGI 2.0.15-debian (64bit) on [Tue May 17 16:13:01 2022] ***
compiled with version: 7.5.0 on 26 August 2021 18:40:50
os: Linux-4.15.0-118-generic #119-Ubuntu SMP Tue Sep 8 12:30:01 UTC 2020
nodename: VM-7-5-ubuntu
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 8
current working directory: /home/code/Manage_Api/quanwang_jira2596
writing pidfile to /home/code/Manage_Api/quanwang_jira2596/jira2596_server.pid
detected binary path: /usr/bin/uwsgi-core
dropping root privileges as early as possible
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
chdir() to /home/code/Manage_Api/quanwang_jira2596
your processes number limit is 63260
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
dropping root privileges after socket binding
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
dropping root privileges after plugin initialization
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
The -s/--socket option is missing and stdin is not a socket.
我查阅了N多的资料,还是解决不了问题;这个时候我就在想是不是uwsgi的版本有问题,应该用pip安装的uwsgi,而不是apt安装的。
然后我再次用pip安装,安装报错,崩溃ing.......
然后我孤注一掷了,决定用pip安装,如果再不成功就放弃在ubuntu上面跑,换centos7。
用pip安装时报错,上网一查,发现是gcc版本太高了,又看了一下centos7里面的gcc版本,果然是ubuntu的gcc版本高,然后就降gcc版本,教程:https://blog.csdn.net/haojie_duan/article/details/124143322,https://blog.csdn.net/feinifi/article/details/121793945,成功降完了还是不行,更加崩溃ing。
然后又发现ubuntu中python版本是3.9,自我感觉问题应该不是python版本,但是也没其它方法了。死马当活马医吧,用conda创建了一个3.8.3(与centos7保持一致)。然后运行了一下,发现好了,真特么是奇迹啊,一步一坑,坑坑都得填..........