use*_*930 3 python google-app-engine path pythonpath
我正在使用Appengine,我正在学习如何在应用程序上使用remote_api.我的问题是我必须将Appengine SDK添加到Python路径,但它并没有解释我如何做到这一点.有人可以解释我如何将Appengine SDK添加到python路径中吗?我对此有点新鲜.非常感谢你!
把它放进去~/.profile.
export CLOUDSDK_ROOT_DIR="/path/to/google/cloud/sdk/"
export APPENGINE_HOME="${CLOUDSDK_ROOT_DIR}/platform/appengine-java-sdk"
export GAE_SDK_ROOT="${CLOUDSDK_ROOT_DIR}/platform/google_appengine"
# The next line enables Java libraries for Google Cloud SDK
export CLASSPATH="${APPENGINE_HOME}/lib":${CLASSPATH}
# The next line enables Python libraries for Google Cloud SDK
export PYTHONPATH=${GAE_SDK_ROOT}:${PYTHONPATH}
# * OPTIONAL STEP *
# If you wish to import all Python modules, you may iterate in the directory
# tree and import each module.
#
# * WARNING *
# Some modules have two or more versions available (Ex. django), so the loop
# will import always its latest version.
for module in ${GAE_SDK_ROOT}/lib/*; do
if [ -r ${module} ]; then
PYTHONPATH=${module}:${PYTHONPATH}
fi
done
unset module
Run Code Online (Sandbox Code Playgroud)
不要放入内部,~/.bashrc因为每次打开bash会话时,所有这些模块都会一次又一次地添加到您的PYTHONPATH环境变量中.
| 归档时间: |
|
| 查看次数: |
3996 次 |
| 最近记录: |