gpt4 book ai didi

python - flask +Nginx+uWSGI : ImportError: No module named site

转载 作者:太空狗 更新时间:2023-10-30 00:50:54 26 4
gpt4 key购买 nike

我安装为http://www.reinbach.com/uwsgi-nginx-flask-virtualenv-mac-os-x.html链接的教程,在执行命令 uwsgi --ini deploy/deploy.ini 时,终端显示出现导入错误:

PYTHONHOME设置为/virtualenv/sample/

ImportError: No module named site

我已经将我的 PYTHONHOMEPYTHONPATH 设置为

export PYTHONPATH=$PYTHONPATH:/Library/Python/2.7/site-packages
export PYTHONHOME=$PYTHONHOME:/Library/Python/2.7

我不知道它有什么问题。

有人可以帮我解决这个问题吗?

如果有帮助,终端中的全部信息如下所示:

(env)ios-devmatoMacBook-Pro:hello ios_dev$ uwsgi --ini deploy/deploy.ini
[uWSGI] getting INI configuration from deploy/deploy.ini
*** Starting uWSGI 1.9.10 (64bit) on [Fri May 17 16:42:22 2013] ***
compiled with version: 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) on 17 May 2013 12:41:07
os: Darwin-11.4.2 Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-
1699.32.7~1/RELEASE_X86_64
nodename: ios-devmatoMacBook-Pro.local
machine: x86_64
clock source: unix
detected number of CPU cores: 4
current working directory: /Users/ios_dev/Desktop/sample/hello
detected binary path: /Users/ios_dev/Documents/little/little-web/little_web_dev/env/bin/uwsgi
your processes number limit is 709
your memory page size is 4096 bytes
detected max file descriptor number: 256
lock engine: OSX spinlocks
uwsgi socket 0 bound to TCP address 127.0.0.1:3031 fd 3
Python version: 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]

PYTHONHOME设置为/virtualenv/sample/

ImportError: No module named site

最佳答案

以下是我如何解决在尝试 Django and NGINX tutorial — uWSGI 2.0 documentation 时收到的相同错误消息 (ImportError: No module named site) .

停用虚拟环境:

deactivate

在系统范围内安装uWSGI(如果还没有在系统范围内安装的话)

sudo pip install uwsgi

编辑uwsgi.ini 文件。我用以下内容注释掉了这一行:

home = /path/to/virtualenv

运行 uWSGI --ini mysite_uwsgi.ini

关于python - flask +Nginx+uWSGI : ImportError: No module named site,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16605048/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com