Django uwsgi没有名为si的模块

2024-09-28 23:38:13 发布

您现在位置:Python中文网/ 问答频道 /正文

首先,我知道有很多相关的问题存在,但没有一个能解决我的问题。 当我的virtualenv激活时,我使用sudo pip3 install uwsgi在centOs 7上安装了uwsgi。我试着用命令运行它

uwsgi --http :8000 --module ashpazi.wsgi --ini ../ini_files/ashpazi.ini 

我得到这个错误

^{pr2}$

这是我的ashpazi.ini文件

[uwsgi]
chdir = /root/projects/ashpazi
home  = /root/projects/venv
module = ashpazi.wsgi:application

master = true
processes = 5

uid = root
gid = nginx
env = DJANGO_SETTINGS_MODULE=ashpazi.settings
plugin = python3.6
socket = /root/projects/sockets/ashapazi.sock
chmod-socket = 777
vacuum = true

运行which uwsgi返回不在virtualenv目录中的/usr/bin/uwsgi。在

运行sudo pip3 show uwsgi返回:

Name: uWSGI
Version: 2.0.15
Summary: The uWSGI server
Home-page: https://uwsgi-docs.readthedocs.io/en/latest/
Author: Unbit
Author-email: info@unbit.it
License: GPL2
Location: /usr/lib/python2.7/site-packages

这说明uwsgi在python2.7文件夹中,而不是我在django项目中使用的python3.6。 我怎样才能解决这个问题?在

编辑:
我使用sudo pip3 install uwsgi,因为不使用sudo将导致此错误

*** uWSGI compiling embedded plugins ***
[gcc -pthread] plugins/python/python_plugin.o
In file included from plugins/python/python_plugin.c:1:0:
plugins/python/uwsgi_python.h:2:20: fatal error: Python.h: No such file 

or directory
 #include <Python.h>
                ^
    compilation terminated.

----------------------------------------
Command "/root/projects/venv/bin/python3.6 -u -c "import setuptools, 
tokenize;__file__='/tmp/pip-build-
yz2o1zz3/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-o6hcf_v3-record/install-record.txt --single-version-
externally-managed --compile --install-headers 
/root/projects/venv/include/site/python3.6/uwsgi" failed with error 
code 1 in /tmp/pip-build-yz2o1zz3/uwsgi/

Tags: installpipvenvpip3sudopluginsrootplugin
2条回答

我终于明白了。为了在pip3中使用uwsgi,我必须首先安装python36u-devel。现在uwsgi安装在venv目录中。在

removing all existing uwsgi packages installed from pip or system package manager
sudo yum install python36u-devel
. venv/bin/activate (using virtual envirement to avoid installing it globally)
pip3 install uwsgi

我也遇到了同样的问题,我的解决方案是用python版本安装python-devel。示例python36u必须安装python36u devel,然后安装“pip3.6 install uwsgi”。在

相关问题 更多 >