python - Google Cloud Function 无法安装 python 包

标签 python google-cloud-platform google-cloud-functions

我最近在https://pypi.org/project/gsuitefy/上发布了一个包 我可以在本地安装该包,没有错误,但是当我在函数的“requirements.txt”中添加包(gsuitefy)时,我收到错误:

Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "`pip_download_wheels` had stderr output:\n  Could not find a version that satisfies the requirement gsuitefy==1.0.3 (from -r requirements.txt (line 5)) (from versions: )\nNo matching distribution found for gsuitefy==1.0.3 (from -r requirements.txt (line 5))\n\nerror: `pip_download_wheels` returned code: 1", "errorType": "InternalError", "errorId": "84C90901"}}

最佳答案

gsuitefy package好像只兼容python2,不兼容python3。

例如使用 python3 虚拟环境:

(venv) $ pip --version
pip 19.3.1 from /home/[XXXXX]/venv/local/lib/python3.7/site-packages/pip (python 3.7)
(venv) $ pip install -v gsuitefy
Created temporary directory: /tmp/pip-ephem-wheel-cache-8fvgqqfg
Created temporary directory: /tmp/pip-req-tracker-itd0y72w
Created requirements tracker '/tmp/pip-req-tracker-itd0y72w'
Created temporary directory: /tmp/pip-install-hlzzykc0
1 location(s) to search for versions of gsuitefy:
* https://pypi.org/simple/gsuitefy/
Getting page https://pypi.org/simple/gsuitefy/
Found index url https://pypi.org/simple
Looking up "https://pypi.org/simple/gsuitefy/" in the cache
Request header has "max_age" as 0, cache bypassed
Starting new HTTPS connection (1): pypi.org:443
https://pypi.org:443 "GET /simple/gsuitefy/ HTTP/1.1" 304 0
Analyzing links from page https://pypi.org/simple/gsuitefy/
  Skipping link: none of the wheel's tags match: py2-none-any: https://files.pythonhosted.org/packages/42/ae/045782c202c626c3b76489a9a1b0b2bf398a956166fc0870719d653e7536/gsuitefy-1.0.3-py2-none-any.wh
l#sha256=44e92f23821eedcdae1f2748b468d1a321541b5ee45c49653adaec079f68369d (from https://pypi.org/simple/gsuitefy/)
  Skipping link: none of the wheel's tags match: py2-none-any: https://files.pythonhosted.org/packages/9d/73/b3b079b9a6cb15c8fb32f950ee504cf0e0af99a8ad11fec636b8aa5a0919/gsuitefy-1.1.0-py2-none-any.wh
l#sha256=1307c572a4ba2ce491cc9177d7c288c40f03ee5c051154863d441a5dd54f6300 (from https://pypi.org/simple/gsuitefy/)
  Skipping link: none of the wheel's tags match: py2-none-any: https://files.pythonhosted.org/packages/a1/15/b126d59768cc0b3ca9e276470f67a602f18767d180771bcbf1e137e17891/gsuitefy-1.1.1-py2-none-any.wh
l#sha256=720178a7ac6056d747cfe1c237ff2e9b3f3207268466c83671931a0e1766c985 (from https://pypi.org/simple/gsuitefy/)
  Skipping link: none of the wheel's tags match: py2-none-any: https://files.pythonhosted.org/packages/21/3f/a2546b4ad2599a6af6304a963e4f3c4be9cf9785bab095cf35c161f1d420/gsuitefy-1.1.2-py2-none-any.wh
l#sha256=ff23036822e04c4aafa4c271ac4064400e3079b8df6a869d66284d58b9c0aeed (from https://pypi.org/simple/gsuitefy/)
Given no hashes to check 0 links for project 'gsuitefy': discarding no candidates
ERROR: Could not find a version that satisfies the requirement gsuitefy (from versions: none)

另一方面,这在 python 2 虚拟环境中安装得很好。

cloud functions python runtime (截至撰写本文时)基于 Python 3.7.1。您需要创建与 Python 3.7 兼容的软件包版本才能正确安装。

关于python - Google Cloud Function 无法安装 python 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58490853/

相关文章:

python - 有机会让它更快吗? (numpy.einsum)

google-cloud-platform - 如何使用 Deployment Manager 将 IAM 策略设置为 Cloud Function

javascript - 异步 https Firebase Google Cloud 功能失败,错误为 "function crashed"/"socket hang up"

firebase - 测试本地运行的 Firebase 函数时无法使用 ImageMagick

python - TF/KERAS : passing a list as loss for single output

python - 按 csv 提取记录并按日期过滤

python - 如何让浏览器响应下载 Django CSV 文件

google-cloud-storage - Google Cloud Storage 中的 GET 操作有何不同?

google-cloud-platform - 谷歌云愿景 : Model Is Not Exporting

javascript - Firebase 的云功能 : completing long processes without touching maximum timeout