【发布时间】:2013-05-12 09:15:53
【问题描述】:
我按照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
我已将PYTHONHOME 和PYTHONPATH 设置为
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
【问题讨论】:
-
你为什么要设置 PYTHONHOME?它也应该是一个目录,而不是像你正在做的那样表示为路径。里面的空条目和冒号会搞砸的。
-
请发布您的
deploy/deploy.ini脚本的内容。 -
@Graham Dumpleton:我在链接的教程中看到有一个 pythonhome 设置语句,所以我只是将它复制到我的文件中。但我不确定是否需要。
-
@kisamoto 这里是 deploy.ini [uwsgi] socket = 127.0.0.1:3031 processes = 2 virtualenv = /virtualenv/sample/ module = myapp callable = app touch-reload = /virtualenv 的内容/示例/你好/