Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么python在uwsgi下通过upstart运行时找不到Gevent?_Python_Uwsgi_Upstart - Fatal编程技术网

为什么python在uwsgi下通过upstart运行时找不到Gevent?

为什么python在uwsgi下通过upstart运行时找不到Gevent?,python,uwsgi,upstart,Python,Uwsgi,Upstart,uwsgi.ini: [uwsgi] wsgi-file = /home/ubuntu/app/wsgi.py chdir = /home/ubuntu/app/ uid = www-data gid = www-data chown-socket = www-data processes = 4 async = 100 gevent = 100 socket

uwsgi.ini:

[uwsgi]
wsgi-file       = /home/ubuntu/app/wsgi.py
chdir           = /home/ubuntu/app/
uid             = www-data
gid             = www-data
chown-socket    = www-data
processes       = 4
async           = 100
gevent          = 100
socket          = /run/uwsgi.sock
logto           = /var/log/uwsgi.log
logdate         = true
post-buffering  = 4096
master          = true
die-on-term     = true
logfile-chown   = true
no-site         = true
uwsgi.conf:

description "uwsgi tiny instance"
start on runlevel [2345]
stop on runlevel [06]

script 
       exec uwsgi /home/ubuntu/app/wsgi.ini
end script

pre-stop script
        rm /run/uwsgi.pid 
end script
运行sudo服务uwsgi start时的错误日志:


为什么会这样?当我在shell中运行python并导入gevent时,一切正常。

检查uWSGI已安装插件的命令:uWSGI-插件列表

如果插件安装后出现错误->导入错误:没有名为gevent的模块


然后安装uwsgi:pip安装uwsgi

检查uwsgi使用的python版本与系统python使用的版本相同binary@roberto是的,他们很抱歉,只是注意到了-没有站点,删除它,在标准设置中没有任何意义哇,出于某种原因,做了这个小把戏没有什么奇怪的,没有站点像用-s调用python一样,这将禁用site.py加载。它仅用于动态虚拟人等特殊技巧。
Mon Dec 22 06:58:20 2014 - *** Starting uWSGI 2.0.6 (64bit) on [Mon Dec 22 06:58:20 2014] ***
Mon Dec 22 06:58:20 2014 - compiled with version: 4.6.3 on 11 August 2014 23:31:50
Mon Dec 22 06:58:20 2014 - os: Linux-3.2.0-69-virtual #103-Ubuntu SMP Tue Sep 2 05:21:29 UTC 2014
Mon Dec 22 06:58:20 2014 - nodename: ip-10-166-222-26
Mon Dec 22 06:58:20 2014 - machine: x86_64
Mon Dec 22 06:58:20 2014 - clock source: unix
Mon Dec 22 06:58:20 2014 - detected number of CPU cores: 1
Mon Dec 22 06:58:20 2014 - current working directory: /
Mon Dec 22 06:58:20 2014 - detected binary path: /usr/local/bin/uwsgi
Mon Dec 22 06:58:20 2014 - !!! no internal routing support, rebuild with pcre support !!!
Mon Dec 22 06:58:20 2014 - your processes number limit is 4592
Mon Dec 22 06:58:20 2014 - your memory page size is 4096 bytes
Mon Dec 22 06:58:20 2014 - detected max file descriptor number: 1024
Mon Dec 22 06:58:20 2014 - - async cores set to 100 - fd table size: 1024
Mon Dec 22 06:58:20 2014 - lock engine: pthread robust mutexes
Mon Dec 22 06:58:20 2014 - thunder lock: disabled (you can enable it with --thunder-lock)
Mon Dec 22 06:58:20 2014 - uwsgi socket 0 bound to UNIX address /run/uwsgi.sock fd 3
Mon Dec 22 06:58:20 2014 - setgid() to 33
Mon Dec 22 06:58:20 2014 - setuid() to 33
Mon Dec 22 06:58:20 2014 - Python version: 2.7.3 (default, Feb 27 2014, 20:09:21)  [GCC 4.6.3]
Mon Dec 22 06:58:20 2014 - Python main interpreter initialized at 0x23e5ec0
Mon Dec 22 06:58:20 2014 - python threads support enabled
Mon Dec 22 06:58:20 2014 - your server socket listen backlog is limited to 100 connections
Mon Dec 22 06:58:20 2014 - your mercy for graceful operations on workers is 60 seconds
Mon Dec 22 06:58:20 2014 - mapped 9560320 bytes (9336 KB) for 400 cores
Mon Dec 22 06:58:20 2014 - *** Operational MODE: preforking+async ***
Traceback (most recent call last):
  File "/home/ubuntu/app/wsgi.py", line 1, in <module>
    from gevent import monkey
ImportError: No module named gevent