2017-09-17 7 views
1

Tout d'abord, je suis au courant de nombreuses questions connexes existent mais aucun d'entre eux a résolu mon problème. J'ai installé uwsgi en utilisant sudo pip3 install uwsgi sur centOs 7 lorsque mon virtualenv est activé. Je tente de l'exécuter avec la commandedjango uwsgi aucun module nommé site

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

Je reçois cette erreur

ImportError: No module named site 

Ceci est mon fichier 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 

Exécution which uwsgi retours /usr/bin/uwsgi qui n'est pas dans le répertoire virtualenv.

Et en cours d'exécution sudo pip3 show uwsgi renvoie cette:

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

qui stipule que uwsgi est dans python2.7 dossier et non python3.6 J'utilise dans mon projet de django. Comment puis-je résoudre ce problème?

Edit:
J'utilise sudo pip3 install uwsgi parce que l'utilisation sans sudo entraînera cette erreur

*** 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/ 
+0

pouvez-vous partager la traceback du message d'erreur –

+1

Vous ne devriez pas utiliser '' sudo pip3 install uwsgi'' lors de l'installation dans un virtualenv. Utilisez simplement '' pip install uwsgi'' après avoir activé virtualenv. En faisant ce que vous avez fait, vous l'avez installé dans le système Python. –

+0

@GrahamDumpleton pouvez-vous s'il vous plaît laissez-nous savoir pourquoi pip3 l'installe au système, tandis que pip installe dans le venv –

Répondre

0

Enfin je me suis dit dehors. Pour utiliser uwsgi dans pip3, je devais d'abord installer python36u-devel. Maintenant, uwsgi est installé dans le répertoire 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 
0

J'ai le même problème, la solution dans mon cas était d'installer python-devel avec la version python. Exemple python36u vous devez installer python36u-devel et ensuite installer "pip3.6 install uwsgi".