简体   繁体   English

如何使用 Conda 下载 python 包,然后离线安装?

[英]How to download python packages using Conda and later install offline?

I know through pip I can download Python packages using the below command.我知道通过 pip 我可以使用以下命令下载 Python 包。 But "pip install" is breaking my internal package dependencies.但是“pip install”正在破坏我内部的 package 依赖项。

When I do:当我做:

pip download <package-name> -d <download-path> 

This is supposed to download packages along with their dependencies.这应该下载软件包及其依赖项。

I tried and failed to find this feature for Conda.我尝试并未能为 Conda 找到此功能。

Please let me know if there's a way to download python packages along with their dependencies through conda and install the latter offline in the virtual environment.请让我知道是否有办法通过 conda 下载 python 软件包及其依赖项,并在虚拟环境中离线安装后者。

I need this method because our client restricted access to Pypi and the Anaconda repository.我需要这种方法,因为我们的客户限制了对 Pypi 和 Anaconda 存储库的访问。

Sounds like you are looking for the --download-only flag.听起来您正在寻找--download-only标志。 From conda install --help :conda install --help

--download-only       Solve an environment and ensure package caches are
                      populated, but exit prior to unlinking and linking
                      packages into the prefix.

The " solve and environment " part indicates that it will include all dependencies. 解决和环境”部分表示它将包括所有依赖项。

The --offline flag could also be helpful for the latter time when you try installing.当您尝试安装时, --offline标志也可能对后面的时间有所帮助。 This will force Conda to attempt to use only the cached packages to satisfy package specifications.这将迫使 Conda 尝试仅使用缓存的包来满足 package 规范。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM