pipenv 仅使用站点包
pipenv to use site-packages only
如何使用 pipenv 以默认使用站点包而不是使用 PyPi 索引的方式安装包。对于上下文,我在我的站点包文件夹中有一个公司批准的包列表。
我仍然想使用 venv 以便正确捕获这些依赖项,而不是直接使用站点包。
您的 python 安装工作中已经安装了某些软件包。 virtualenv 创建一个环境,它有自己的安装目录,不与其他 virtualenv 环境共享库(也可选择不访问全局安装的库)。您的问题听起来您可能想与新的 virtualenv 共享库。无法访问全局站点包现在是默认行为。但是你can override defaults if this suits your use case. But a can not serve as a source for pip, but can be shared with another virtual environment - but (re-)creating the versioning issue virtualenv was made to solve.
为了可重复性,您可以使用 pip freeze. If you want to recreate this python installation at another system you need to tell pip where to find (any restricted set of) source packages if it should not use PyPI. If the company approved packages are available on PyPI - then just build up the new environment explicitly from a requirements.txt freezed from your default python installation. You can even build up a python env using editable installs 冻结当前的包列表 - 如果您可以访问任何公司开发的 python 包的源代码。
pip 有 numerous options to install packages from different sources。选项 7 和 8 让您了解如何从源存档或备用包存储库或本地文件系统安装。
pipenv 发明了一种叫做 Pipfile. This file pins package dependencies and define sources (like PyPI) for dependencies 的东西。你必须弄清楚你是如何引用替代资源的。 [[source]]
个条目的顺序可能很重要。
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[[source]]
url = "http://pypi.home.kennethreitz.org/simple"
verify_ssl = false
name = "home"
[dev-packages]
url = "http://mycompany.package.repo/simple/"
verify_ssl = false
name = "company-approved-packages"
[packages]
requests = "*"
如何使用 pipenv 以默认使用站点包而不是使用 PyPi 索引的方式安装包。对于上下文,我在我的站点包文件夹中有一个公司批准的包列表。
我仍然想使用 venv 以便正确捕获这些依赖项,而不是直接使用站点包。
您的 python 安装工作中已经安装了某些软件包。 virtualenv 创建一个环境,它有自己的安装目录,不与其他 virtualenv 环境共享库(也可选择不访问全局安装的库)。您的问题听起来您可能想与新的 virtualenv 共享库。无法访问全局站点包现在是默认行为。但是你can override defaults if this suits your use case. But a
为了可重复性,您可以使用 pip freeze. If you want to recreate this python installation at another system you need to tell pip where to find (any restricted set of) source packages if it should not use PyPI. If the company approved packages are available on PyPI - then just build up the new environment explicitly from a requirements.txt freezed from your default python installation. You can even build up a python env using editable installs 冻结当前的包列表 - 如果您可以访问任何公司开发的 python 包的源代码。 pip 有 numerous options to install packages from different sources。选项 7 和 8 让您了解如何从源存档或备用包存储库或本地文件系统安装。
pipenv 发明了一种叫做 Pipfile. This file pins package dependencies and define sources (like PyPI) for dependencies 的东西。你必须弄清楚你是如何引用替代资源的。 [[source]]
个条目的顺序可能很重要。
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"
[[source]]
url = "http://pypi.home.kennethreitz.org/simple"
verify_ssl = false
name = "home"
[dev-packages]
url = "http://mycompany.package.repo/simple/"
verify_ssl = false
name = "company-approved-packages"
[packages]
requests = "*"