Python Conda - 离线安装/更新

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41577527/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 01:15:45  来源:igfitidea点击:

Conda - offline install / update

pythonanacondaconda

提问by keynesiancross

I'm trying to offline update xlwings in Anaconda / conda.

我正在尝试离线更新 Anaconda / conda 中的 xlwings。

From https://pypi.python.org/pypi/xlwings, I downloaded the most recent package, and put it into "C:\Program Files\Anaconda2\pkgs"

https://pypi.python.org/pypi/xlwings,我下载了最新的包,并将其放入“C:\Program Files\Anaconda2\pkgs”

From Cmd, I've tried a number of different combinations, but I can't seem to get it to update the package... For example:

在 Cmd 中,我尝试了多种不同的组合,但似乎无法使用它来更新包...例如:

1) conda install xlwings --offline
2) conda install xlwings --offline xlwings-0.10.2.tar.gz
3) conda update xlwings --offline
4) conda update xlwings --offline xlwings-0.10.2.tar.gz

Attempts 2 & 4 (I've tried using the full directory for these as well) result in unrecgonized command.

尝试 2 和 4(我也尝试使用完整目录)导致无法识别的命令。

Attempts 1 & 3 results in: enter image description here

尝试 1 和 3 导致: 在此处输入图片说明

Thanks in advance!

提前致谢!

回答by h3h325

First download the rellevant package-name.tar.bz2 file, (from anaconda repository)

首先下载相关的 package-name.tar.bz2 文件,(来自anaconda 仓库

Open command prompt, cd to apropiate directory and type

打开命令提示符,cd 到 apropiate 目录并键入

conda install package-name.tar.bz2

This should work.

这应该有效。

回答by maggie

If you want to update/install a conda package you'll need to download the corresponding conda package (you downloaded the pip package) into your pkgsdirectory.

如果您想更新/安装 conda 包,您需要将相应的 conda 包(您下载了 pip 包)下载到您的pkgs目录中。

conda install xlwings --use-index-cache

Was working for me in the past. But the channel's index cache should have been updated at least once. It is possible that you still need the --offlineflag but I've never used it. But you have to check the dependencies of the packages to be installed by yourself which can be pretty time consuming as you have to download all other packages manually.

过去为我工作。但是频道的索引缓存应该至少更新一次。您可能仍然需要该--offline标志,但我从未使用过它。但是您必须自己检查要安装的软件包的依赖关系,这可能非常耗时,因为您必须手动下载所有其他软件包。

You can find the conda packages in the channel you are using (https://repo.continuum.io/pkgs/free/win-32/in my case).

您可以在您使用的频道中找到 conda 包(在我的情况下为https://repo.continuum.io/pkgs/free/win-32/)。

If you want to install a pip package offline just use

如果你想离线安装 pip 包,只需使用

pip install package.tar.gz

pipalso comes with your anaconda distribution. If you are using conda environments, pip will be on the path of your current environment.

pip还附带您的 anaconda 发行版。如果您使用的是 conda 环境,则 pip 将位于您当前环境的路径上。

回答by skibee

From my experience the process is:

根据我的经验,这个过程是:

  1. on a computer that is connected to the internet install the relevant packages.
  2. copy the relevant tar.bz2files form the ~/anaconda3/pkgs folder
  3. in the offline computer run conda update name_of_packge.tar.bz2 --offline.
  1. 在连接到 Internet 的计算机上安装相关软件包。
  2. tar.bz2从 ~/anaconda3/pkgs 文件夹复制相关文件
  3. 在离线电脑上运行conda update name_of_packge.tar.bz2 --offline

you may want to run conda indexon the pkgsfolder

你可能想conda indexpkgs文件夹上运行

update
Another option is to use conda pack. This allows to transfer entire environments from online to offline.

更新
另一种选择是使用conda pack。这允许将整个环境从在线转移到离线。

回答by InLaw

You should use a combination of both answers.

您应该结合使用这两个答案。

conda install opencv --use-index-cache

to let conda check for dependencies and compatibility issues.

让 conda 检查依赖项和兼容性问题。

But keep using conda (not pip) for the installation (if you don′t have serious reasons not to stay in the initial framework) [wasn′t the reason using conda as package manager because pip couldn't′t provide you those opportunities and flexibility?]

但是继续使用 conda(而不是 pip)进行安装(如果您没有重要的理由不留在初始框架中)[不是使用 conda 作为包管理器的原因,因为 pip 无法为您提供这些机会和灵活性?]

conda install opencv-3.3.0-py36_200.tar.bz2