[英]Using gspread in GAE
I am unable to get a Python package, gspread , to work in GAE. 我无法获取Python包gspread在GAE中工作。
My project is in D:\\Documents\\Google Cloud\\myapp
. 我的项目在
D:\\Documents\\Google Cloud\\myapp
。 I installed gspread
using: 我使用以下方法安装了
gspread
:
c:\python27\python.exe setup.py install --home="D:\Documents\Google Cloud\myapp"
All the files appear to be installed in D:\\Documents\\Google Cloud\\myapp\\lib\\python
without offering me a choice. 所有文件似乎都安装在
D:\\Documents\\Google Cloud\\myapp\\lib\\python
但我没有选择。 In fact, I have to add this path to PYTHONPATH
in order for setup.py to run properly. 实际上,我必须将此路径添加到
PYTHONPATH
才能使setup.py正常运行。
If I then run Python, I can import gspread
in the interpreter. 如果然后运行Python,则可以在解释器中
import gspread
。
However, in myapp, I can't import ( ImportError: No module named gspread
) even when I added that long path to sys.path
. 但是,在myapp中,即使将长路径添加到
sys.path
,我也无法导入( ImportError: No module named gspread
)。 My sys.path
at run-time contains, among other values,: 我的
sys.path
在运行时包含以下其他值:
'D:\\Documents\\Google Cloud\\myapp\\lib\\python'
'D:\\Documents\\Google Cloud\\myapp'
'D:\\Documents\\Google Cloud\\myapp\\lib'
What is needed to get this third party module to work? 要使该第三方模块正常工作需要什么?
I got it to work by adding the following, path of a file and not a folder, to sys.path
: 我通过将以下文件路径而不是文件夹路径添加到
sys.path
来使其工作:
D:\Documents\Google Cloud\Drive-1185\lib\python\gspread-0.2.5-py2.7.egg
A relative path may be used as the working directory is the app directory. 相对路径可用作app目录的工作目录。 To deploy to Google's servers, obviously only a relative path can be used, and not only that, backward slashes must be replaced with forward slashes.
要部署到Google的服务器,显然只能使用相对路径,不仅如此,还必须用正斜杠代替反斜杠。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.