google dev_appserver 在升级到 python 3.7 后抛出错误 'python2: command not found'
google dev_appserver throws error 'python2: command not found' after upgrade to python 3.7
直到昨天,我才成功地使用 dev_appserver.py app.yaml --enable_console
进行开发。
昨天我试图升级到 python 3.7 用于我的开发。
升级似乎没问题,但现在我收到以下错误信息。
server:bones brian$ dev_appserver.py app.yaml --enable_console
ERROR: (dev_appserver) python2: command not found
app.yaml:
application: bones
version: 1
runtime: python37
entrypoint: gunicorn -b :$PORT main:app
api_version: 1
threadsafe: true
handlers:
- url: /static
static_dir: static
- url: /.*
script: main.app
我正在使用 Mac OS X 10.11.6.
为什么 dev_appserver 还要寻找 python2?
我该如何解决这个问题?
看起来你无法解决这个问题:
Running dev_appserver requires the presence of Python 2.7.12+ on your local machine.
我有一个 Python 3.7 Google App Engine 项目,但出于同样的原因 (python2: command not found
),我无法执行 dev_appserver.py
命令。由于各种原因,降级到 Python 2.7.
是不可行的
我不认为 here (that dev_appserver.py
is only meant to work with Python 2.7) is accurate; the GAE documentation for Python 3.7 in fact lists dev_appserver.py
是本地开发的一个选项。这看起来更像是一个 gcloud
错误。
(注意:我知道这作为对先前答案的评论会更好,但因为我是一个新的 SO 用户,我还没有 post 评论的权限)
如其他答案所述,dev_appserver 需要 Python 2.7.12+
OSX 用户需要 运行:
brew install pr0d1r2/python2/python@2.7.17 --build-from-source
我会把这个添加为对以前答案的评论,但我没有足够的 Whosebug 信用
只需要在计算机上安装 python2(即使您的应用程序在 python3)。
所以,解决方案就是:
sudo apt-get install python2 python2-dev
(2021 年 8 月更新):措辞最近更改为“运行 dev_appserver
需要 Python 2.7.12 或更新版本在你的本地机器上。”这仍然不清楚,所以我提交了一个错误以使其更明确。一旦获得批准,文本会说一些大意为:“注意: 运行 dev_appserver.py
要求您有 Python 2 口译员在本地计算机上安装 2.7.12 或更高版本。这适用于 App Engine 标准环境中的所有运行时。"
直到昨天,我才成功地使用 dev_appserver.py app.yaml --enable_console
进行开发。
昨天我试图升级到 python 3.7 用于我的开发。
升级似乎没问题,但现在我收到以下错误信息。
server:bones brian$ dev_appserver.py app.yaml --enable_console
ERROR: (dev_appserver) python2: command not found
app.yaml:
application: bones
version: 1
runtime: python37
entrypoint: gunicorn -b :$PORT main:app
api_version: 1
threadsafe: true
handlers:
- url: /static
static_dir: static
- url: /.*
script: main.app
我正在使用 Mac OS X 10.11.6.
为什么 dev_appserver 还要寻找 python2? 我该如何解决这个问题?
看起来你无法解决这个问题:
Running dev_appserver requires the presence of Python 2.7.12+ on your local machine.
我有一个 Python 3.7 Google App Engine 项目,但出于同样的原因 (python2: command not found
),我无法执行 dev_appserver.py
命令。由于各种原因,降级到 Python 2.7.
我不认为 dev_appserver.py
is only meant to work with Python 2.7) is accurate; the GAE documentation for Python 3.7 in fact lists dev_appserver.py
是本地开发的一个选项。这看起来更像是一个 gcloud
错误。
(注意:我知道这作为对先前答案的评论会更好,但因为我是一个新的 SO 用户,我还没有 post 评论的权限)
如其他答案所述,dev_appserver 需要 Python 2.7.12+
OSX 用户需要 运行:
brew install pr0d1r2/python2/python@2.7.17 --build-from-source
我会把这个添加为对以前答案的评论,但我没有足够的 Whosebug 信用
只需要在计算机上安装 python2(即使您的应用程序在 python3)。
所以,解决方案就是:
sudo apt-get install python2 python2-dev
(2021 年 8 月更新):措辞最近更改为“运行 dev_appserver
需要 Python 2.7.12 或更新版本在你的本地机器上。”这仍然不清楚,所以我提交了一个错误以使其更明确。一旦获得批准,文本会说一些大意为:“注意: 运行 dev_appserver.py
要求您有 Python 2 口译员在本地计算机上安装 2.7.12 或更高版本。这适用于 App Engine 标准环境中的所有运行时。"