[英]How can I install a local Python package with extra components using pip?
pip
supports installing extra components while installing a Python package from internet, eg, pip
支持在从 Internet 安装 Python package 时安装额外组件,例如,
pip install dask[all]
pip install "dask[all] @ git+https://github.com/dask/dask"
However, does it support installing extra components when installing from a local Python package?但是,从本地 Python package 安装时是否支持安装额外组件? For example, if I have the dask Python package downloaded to local, how can I install it with specific extra components?
例如,如果我将 dask Python package 下载到本地,如何使用特定的额外组件安装它?
I've just figured it out.我刚刚想通了。
pip3 install "dsutil[cv] @ file:///home/dclong/dsutil-0.54.1-py3-none-any.whl"
Yes, you can install extras from a local package.是的,您可以从本地 package 安装附加功能。 If they're defined in the package's
setup.py
file in the extras_require
dictionary, then you can install them with pip install."[extra1, extra2]"
.如果它们是在
extras_require
字典中包的setup.py
文件中定义的,那么您可以使用pip install."[extra1, extra2]"
安装它们。 For example, if you have the following in your setup.py
:例如,如果您的
setup.py
中有以下内容:
extras_require={
'docs': ["sphinx>=1.6", "sphinx_rtd_theme>=0.2.4", "sphinx-click"],
'dev': ["pre-commit>=2.10.0"]
},
you can install the docs
and dev
extras with pip install ".[docs, dev]"
when you're in the directory containing setup.py
(you'd use the path to the directory containing setup.py
in the place of .
otherwise).当您在包含
setup.py
的目录中时,您可以使用pip install ".[docs, dev]"
docs
dev
附加功能(您可以使用包含setup.py
的目录的路径代替.
否则)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.