首页 > 解决方案 > 如何使用“pipenv”安装“python-firebase”

问题描述

简而言之, 不工作时如何使用 pipenv
安装最新版本的 pip 包?python-firebasepipenv install python-firebase


完整的细节

为了让 firebase 使用 python 代码,按照 firebase homepage here的官方指导,我使用python-firebase那里列出的库。

通过运行安装它pipenv install python-firebase我的代码导致以下错误。

Traceback (most recent call last):
  File "/home/namgivu/code/namgivu/l/gcp/gcp_firebase_start/_.py", line 56, in <module>
    from firebase import firebase
  File "/home/namgivu/code/namgivu/l/gcp/gcp_firebase_start/.venv/lib/python3.10/site-packages/firebase/__init__.py", line 3
    from .async import process_pool
          ^^^^^
SyntaxError: invalid syntax

解决方案是安装最新版本的 python-firebase,如此所述,但直接通过 pip 而不是 pipenv

pip install git+https://github.com/ozgur/python-firebase

我用 pipenv inplaceof pip 试过了,但没有用

pipenv install git+https://github.com/ozgur/python-firebase

所以我的问题是在 Pipfile 中放入什么,以便我们可以通过简单的安装命令在我们的 python 代码中准备好 firebase 服务pipenv install

标签: pythonfirebasepippipenv

解决方案


根据这里的文档pipenv

pipenv install 完全兼容 pip install 语法

所以你可以试试

pipenv install \
    git+https://github.com/ozgur/python-firebase@0d79d7609844569ea1cec4ac71cb9038e834c355#egg=python-firebase

正如您所链接的建议所建议的那样。#egg=python-firebase附加注意事项,因为pipenv需要#egg版本控制依赖项的片段。

要回答您的问题,以下是由Pipfile生成的pipenv,尽管您应该依靠pipenv为您生成此文件。


[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
python-firebase = {ref = "0d79d7609844569ea1cec4ac71cb9038e834c355", git = "https://github.com/ozgur/python-firebase"}

[dev-packages]

[requires]
python_version = "3.9"

推荐阅读