0

I have a Python script that uses some of my own packages in my own library which is stored in a non-standard folder: k:\lib. When running the script from the command-line the interpreter can find my packages because I have set the PYTHONPATH environment variable.

However, when running the script as a CGI script, the environment variable does not seem to be read, so my question is what can I do about this?

One solution I read was to put

import sys
sys.path.append( 'k:\\lib' )

at the top of my script but this doesn't work - the next line in my script is

import site_consts

where site_consts is in k:\lib but I get the error message "no module named site_consts".

Not sure if this is Python problem or a Windows or an Apache one.

4

1 回答 1

0

您可以将文件添加到文档中描述name.pth四个目录之一。

于 2012-12-16T08:44:27.670 回答