我以前运行过凭证管理服务器。当我今天试图让它运行时,我发现一个错误,它不支持Python3:-
ERROR: Python 3 and later is not compatible with the Google Cloud SDK.
Please use Python version 2.7.x.
If you have a compatible Python interpreter installed, you can use it by setting
the CLOUDSDK_PYTHON environment variable to point to it.
所以我输入了以下命令:-
export CLOUDSDK_PYTHON=/usr/bin/python
重建环境并重新启动服务器。现在,当我试图访问服务器时,似乎在Python3版本的"print“上出现了错误。
Q1。仅与Python3兼容吗?
Q2。我能让Python 3版本在这个环境下正确运行吗?
ERROR 2018-10-01 04:36:24,384 wsgi.py:263]
Traceback (most recent call last):
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/google/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/home/maherrj/credential-management-api/working/main.py", line 28, in <module>
from oauth2client import client
File "/home/maherrj/credential-management-api/working/lib/oauth2client/client.py", line 39, in <module>
from oauth2client import transport
File "/home/maherrj/credential-management-api/working/lib/oauth2client/transport.py", line 17, in <module>
import httplib2
File "/home/maherrj/credential-management-api/working/lib/httplib2/__init__.py", line 382
print('%s:' % h, end=' ', file=self._fp)
^
SyntaxError: invalid syntax
发布于 2018-10-01 01:02:59
我想你是在混合一些概念:
app.yaml
文件,它显式地提到使用该版本。因此,如果可能的话,您必须将该代码移植到Python 3,或者继续使用Python2.7。
https://stackoverflow.com/questions/52584755
复制