- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
(我认为[!])我了解pipenv
(以及其他venvs)背后的原理并经常使用它们。但是,我从来没有真正理解为什么 pipenv
需要一个 Pipfile
和一个 Pipfile.lock
文件。
Now, once you get your code and Pipfile.lock in your production environment, you should install the last successful environment recorded:
$ pipenv install --ignore-pipfile
但它没有解释为什么 Pipfile.lock
需要被使用。即 .lock
文件包含哪些 Pipfile
不包含的内容,以及为什么 Pipfile
足以与其他开发人员共享:
Now let’s say another developer wants to make some additions to your code. In this situation, they would get the code, including the Pipfile, and use this command:
$ pipenv install --dev
但还不足以用于在生产环境中复制您的环境吗?
最佳答案
官方 Pipfile 项目 has something to say about this :
The concrete requirements for a Python Application would come from
Pipfile
. This would include where the packages should be fetched from and their loose version constraints.The details of the environment (all installed packages with pinned versions and other details) would be stored in
Pipfile.lock
, for reproducibility. This file will be automatically generated and should not be modified by the user.
换句话说,Pipfile
用于人,Pipfile.lock
用于计算机。
在您的 Pipfile
中,您列出了您想要的内容,并以一种有点松散的方式定义它们,例如“Django 版本 2 或更高版本”。但这还不足以确定性地重现环境。这意味着“Django 2.0.3”还是“Django 2.1.0”?
Pipfile.lock
准确地指定了要求,它还准确地指定了依赖性。例如,如果您明确想要 foo
并将其放入您的 Pipfile
,您的 Pipfile.lock
将生成,将其锁定到特定版本.如果foo
本身依赖于bar
,而bar
依赖于quux
和florp
, Pipfile.lock
文件也会锁定 bar
、quux
和 florp
,因此依赖项中的细微差别不会'打破东西。
关于python - 为什么 pipenv 需要 Pipfile 和 Pipfile.lock?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52951316/
是否有任何解析器可以读取 Pipfile 并返回 Pipfile 中使用的所有包的列表? 如果没有,怎么办?我在想一个正则表达式可以完成这项工作,但我对 Pipfiles 的结构还不够熟悉,无法确认是
在 Python 打包的上下文中,Pipfile/Pipfile.lock 似乎是 requirements.txt 的替代品。但是,关于这些实际工作原理的文档并不多。我在 Python 网站 h
当我尝试构建我的 Dockerfile 时遇到此错误。我该如何解决这个问题? 无法计算缓存键:“/Pipfile.lock”未找到:未找到 # Pull base image FROM python:
当我尝试使用 pip install 终端将包安装到 Django 时,显示包已安装并且我可以看到进度,但 Pipfile 或 Pipfile.lock 中没有显示任何内容。 我遵循的步骤: pip
(我认为[!])我了解pipenv(以及其他venvs)背后的原理并经常使用它们。但是,我从来没有真正理解为什么 pipenv 需要一个 Pipfile 和一个 Pipfile.lock 文件。 Th
可以在 Pipfile 中指定来自自定义 Git 存储库的包。但是我找不到关于如何指定具体分支或用于安装的提交的综合文档。 是否有关于如何在 pipenv 支持的 Pipfile 中为 python
要为 python 项目创建一个 pipenv,我首先创建一个项目文件夹并进入该文件夹以指示 pipenv 创建 Pipfile、Pipfile.lock 和关联的虚拟环境如下所示: $ mkdir
我可以按照说明 here 将我正在处理的源文件安装到可编辑的包目录中. 所以我的 Pipenv 看起来像 [dev-packages] pytest = "*" my-package= {editab
如何执行 Pipfile 中定义的脚本? 遵循找到的语法 here ,我在我的 pipfile 中定义了 scripts 部分,如下所示: [scripts] tests = "bash ./run-
这个问题已经有答案了: Pipfile.lock out of date (10 个回答) 已关闭 4 年前。 尝试将 python 脚本推送到 heroku,它提示我的 pipfile.lock 已
这个问题已经有答案了: Pipfile.lock out of date (10 个回答) 已关闭 4 年前。 尝试将 python 脚本推送到 heroku,它提示我的 pipfile.lock 已
我刚刚启动了一个新的 Django 项目并使用 Postgresql 作为我的数据库,所以我安装了 psycopg2 以使其正常工作。当我一开始部署该项目时,该应用程序无法运行,因为生产服务器上未安装
我正在我正在开发的一个新项目中使用pipenv。最初的 pipenv install 是 Django,Pipfile 显示: [packages] django = "*" 和Pipfile.loc
当我开始克隆一个使用 pipenv 的 git 项目时,问题就出现了,所以它有一个 Pipfile + Pipfile.lock。我想在项目中使用虚拟环境,所以我运行 pipenv shell .我现
我正在研究使用 pipenv 和此处的文档 https://pipenv.pypa.io/en/latest/basics/#importing-from-requirements-txt 它说(强调
我正在尝试将一个大型 django 项目部署到 heroku。我安装了 Heroku CLI,登录,创建了一个应用程序并运行: git push heroku master 我已经设置了 Pipfil
是否可以在 pipfile 中设置自定义部分? 默认情况下,我只看到 [packages]和 [dev-packages] ,但我对某些环境有额外的依赖。所以我想安装packages例如 [tests
我们使用内置的单元测试(或 Django 的包装器)来测试 Python 项目。 在其中一些测试中,我们使用了诸如 freezegun 或 mock 之类的库,这些库并未在生产代码库中的任何地方使用。
我的 Pipfile 看起来像 [[source]] url = "https://pypi.python.org/simple" verify_ssl = true name = "pypi" [p
我想切换到 pipenv ,但转换我当前的 requirements.txt 不是 1:1。 requirements.txt 包含: ... lxml==3.8.0 --no-binary :all
我是一名优秀的程序员,十分优秀!