我是Google App Engine的新手,所以请耐心等待。
在尝试在本地设置GAE的hello-world Python项目时,我收到一些关于GAE如何不支持python 2.7的错误。
如何在本地配置GAE以使其指向我的自定义python 2.5安装,它位于/usr/local/python-2.5而不是默认系统? (2.7与狮子)
我的系统配置:
OS: Mac OS 10.7
GoogleAppEngineLauncher: 1.5.2
我尝试运行应用时在控制台中看到的错误:
*** Running dev_appserver with the following flags:
--admin_console_server= --port=8080
Python command: /usr/bin/python2.6
Warning: You are using a Python runtime (2.6) that is more recent than the production runtime environment (2.5). Your application may use features that are not available in the production environment and may not work correctly when deployed to production.
WARNING 2011-08-02 23:53:51,987 datastore_file_stub.py:511] Could not read datastore data from /var/folders/08/jlb1tb7s3hq1jhh9qzxfpqbw0000gn/T/dev_appserver.datastore
INFO 2011-08-02 23:53:51,989 rdbms_sqlite.py:58] Connecting to SQLite database '' with file '/var/folders/08/jlb1tb7s3hq1jhh9qzxfpqbw0000gn/T/dev_appserver.rdbms'
WARNING 2011-08-02 23:53:51,995 dev_appserver.py:4749] Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO 2011-08-02 23:53:52,052 dev_appserver_multiprocess.py:637] Running application helloworld on port 8080: http://localhost:8080
INFO 2011-08-02 23:54:15,229 dev_appserver_main.py:667] Server interrupted by user, terminating
答案 0 :(得分:2)
我发现使用GAE SDK和python 2.7的最简单方法是安装Mac端口(http://www.macports.org/)并从那里安装python 2.7。
安装macport后:
$ sudo port install python27 # To install python 2.7
然后从Googleappenginelauncher菜单中打开Preferences并将/opt/local/bin/python2.7放在Python路径字段中。
例如,要安装PIL或lxml,只需在shell中输入以下命令:
# For PIL
$ sudo port install py27-pil
# For Lxml
$ sudo port install py27-lxml
答案 1 :(得分:1)
在启动器中,单击GoogleAppEngineLauncher -> Preferences
,并在标记为“Python Path”的字段中填写Python二进制文件的路径。