0
我已經用無堆棧的Python設置了Apache2 mod_python環境,它正在工作。 當我與sys.version
測試Python環境,這表明mod_python不加載無堆棧Python
2.5.2 Stackless 3.1b3 060516 (python-2.52:76701, Dec 8 2009, 02:13:34)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)]
在瀏覽器中。
但是當我做import stackless
它表明:
MOD_PYTHON ERROR
ProcessId: 26177
Interpreter: '127.0.1.1'
ServerName: '127.0.1.1'
DocumentRoot: '/var/www/'
URI: '/test.py'
Location: None
Directory: '/var/www/'
Filename: '/var/www/test.py'
PathInfo: ''
Phase: 'PythonHandler'
Handler: 'mod_python.publisher'
Traceback (most recent call last):
File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
result = object(arg)
File "/usr/local/lib/python2.5/site-packages/mod_python/publisher.py", line 204, in handler
module = page_cache[req]
File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 1059, in __getitem__
return import_module(req.filename)
File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 296, in import_module
log, import_path)
File "/usr/local/lib/python2.5/site-packages/mod_python/importer.py", line 680, in import_module
execfile(file, module.__dict__)
File "/var/www/test.py", line 1, in <module>
import stackless
ImportError: No module named stackless
MODULE CACHE DETAILS
Accessed: Tue Dec 8 08:53:24 2009
Generation: 0
_mp_27cc55c5447f9e0aa13691719290c225 {
FileName: '/var/www/test.py'
Instance: 1 [IMPORT]
Generation: 0 [ERROR]
Modified: Tue Dec 8 08:52:43 2009
}
而且我不能夠加載MySQLdb的,NLTK,等等。所有這些模塊可以在命令行加載。所以我的猜測是不知何故mod_python指的是舊的Python安裝。
可能是什麼問題?
我已經安裝了所有與堆棧無關的東西。正如你可以看到我的sys.version
響應
2.5.2 Stackless 3.1b3 060516 (python-2.52:76701, Dec 8 2009, 02:13:34) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)]
這是從代碼的響應:
import sys
def index(req):
return sys.version
但是當我添加import stackless
如下它拋出上述錯誤:
import sys
import stackless
def index(req):
return sys.version
有什麼,我失蹤?
從命令行和從mod_python啓動的Python實例之間的sys.path有任何區別嗎? 「ImportError:No module named ...」通常是由不正確的PYTHONPATH設置引起的。 – Simon 2009-12-10 11:09:40