【发布时间】:2024-05-17 18:30:02
【问题描述】:
我正在尝试使用烧瓶部署一个用 python3.6 编写的谷歌云应用引擎应用程序。
这是错误:
Step #1: Collecting pip==10.0.1 (from -r requirements.txt (line 1))
Step #1: Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
Step #1: Collecting Flask==0.12.2 (from -r requirements.txt (line 2))
Step #1: Downloading https://files.pythonhosted.org/packages/77/32/e3597cb19ffffe724ad4bf0beca4153419918e7fa4ba6a34b04ee4da3371/Flask-0.12.2-py2.py3-none-any.whl (83kB)
Step #1: Collecting gunicorn==19.7.1 (from -r requirements.txt (line 3))
Step #1: Downloading https://files.pythonhosted.org/packages/64/32/becbd4089a4c06f0f9f538a76e9fe0b19a08f010bcb47dcdbfbc640cdf7d/gunicorn-19.7.1-py2.py3-none-any.whl (111kB)
Step #1: Collecting oauth2client==4.1.2 (from -r requirements.txt (line 4))
Step #1: Downloading https://files.pythonhosted.org/packages/82/d8/3eab58811282ac7271a081ba5c0d4b875ce786ca68ce43e2a62ade32e9a8/oauth2client-4.1.2-py2.py3-none-any.whl (99kB)
Step #1: Collecting google-cloud (from -r requirements.txt (line 5))
Step #1: Downloading https://files.pythonhosted.org/packages/49/9a/943f0e217990c37e119101bbb739d86201ec1fdf59152ecc2dba93c5a8ad/google-cloud-0.33.0.tar.gz
Step #1: Complete output from command python setup.py egg_info:
Step #1: Traceback (most recent call last):
Step #1: File "<string>", line 1, in <module>
Step #1: File "/tmp/pip-build-agnydxp0/google-cloud/setup.py", line 22, in <module>
Step #1: with open(os.path.join(PACKAGE_ROOT, 'setup-README.rst')) as file_obj:
Step #1: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-agnydxp0/google-cloud/setup-README.rst'
Step #1:
Step #1: ----------------------------------------
Step #1: [91mCommand "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-agnydxp0/google-cloud/
Step #1: [0m[91mYou are using pip version 9.0.3, however version 10.0.1 is available.
Step #1: You should consider upgrading via the 'pip install --upgrade pip' command.[0m[91m
Step #1: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
Finished Step #1
ERROR
ERROR: build step 1 "gcr.io/cloud-builders/docker@sha256:2357779cf996af7c1538a7035ab26073274de0d03e9eaf156e33083f5a90280a" failed: exit status 1
Step #1: [0m
我搜索了一下,发现这个错误是因为pip版本过时造成的。但是,我将 pip==10.0.1 放在了我的 requirements.txt 中,但它仍然不起作用。
有没有办法远程运行pip install --upgrade pip?如果是这样,我该怎么做?
编辑:
这是我的清单文件 app.yaml:
runtime: python
env: flex
entrypoint: gunicorn -b :$PORT main:app
runtime_config:
python_version: 3
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 0.5
disk_size_gb: 10
【问题讨论】:
-
你能显示你的清单文件吗?
-
@DriesDeRydt 在 :D 中编辑了清单
-
我从来不需要指定 pip 版本,我认为应用引擎运行时有自己的。如果您愿意,您可以尝试指定自定义运行时而不是 python,然后使用 Dockerfile。 cloud.google.com/appengine/docs/flexible/custom-runtimes/… 这样您就可以更好地控制构建过程。
-
如果您的系统上同时安装了 python 2 和 3 版本,请检查您是否正在为 python 3 运行 pip - 在我的情况下,
pip默认为 python2 版本。或者使用pip3而不是pip,这样可以确保您运行的是版本3,而不管系统上的默认python 版本是哪个。 -
@DanCornilescu 问题出在 gcloud 平台上,所以我的本地设置在这里无关紧要。无论如何谢谢:D
标签: python-3.x google-app-engine