简体   繁体   English

如何离线安装ipywidgets(从文件)

[英]How to install ipywidgets offline (from file)

So I am trying to install ipywidgets-0.0.1 into my Anaconda environment. 所以我试图将ipywidgets-0.0.1安装到我的Anaconda环境中。 I am running Anaconda3. 我正在运行Anaconda3。 Unfortunately, the machine I need to install it on does not have internet access. 不幸的是,我需要在其上安装的计算机无法访问互联网。

The basic way to install the package is to run conda install ipywidgets , but of course this gives the following error: 安装软件包的基本方法是运行conda install ipywidgets ,但是当然会出现以下错误:

Fetching package metadata: Could not connect to https://repo.continuum.io/pkgs/p
ro/noarch/
Could not connect to https://repo.continuum.io/pkgs/free/win-64/
Could not connect to https://repo.continuum.io/pkgs/pro/win-64/
.Could not connect to https://repo.continuum.io/pkgs/free/noarch/
...
Solving package specifications: .
Package plan for installation in environment C:\Program Files\Anaconda3:

The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ipywidgets-0.0.1           |       np19py34_0           7 KB

The following NEW packages will be INSTALLED:

    ipywidgets: 0.0.1-np19py34_0

Proceed ([y]/n)? y

Fetching packages ...
Could not connect to https://repo.continuum.io/pkgs/free/win-64/ipywidgets-0.0.1
-np19py34_0.tar.bz2
Error: Connection error: HTTPSConnectionPool(host='repo.continuum.io', port=443)
: Max retries exceeded with url: /pkgs/free/win-64/ipywidgets-0.0.1-np19py34_0.t
ar.bz2 (Caused by ProtocolError('Connection aborted.', gaierror(11004, 'getaddri
nfo failed'))): 
https://repo.continuum.io/pkgs/free/win-64/ipywidgets-0.0.1-np19py34_0.tar.bz2

This makes sense, since the box can't access the internet. 这是有道理的,因为盒子无法访问互联网。 I downloaded the ipywidgets tarball from the listed URL at https://repo.continuum.io/pkgs/free/win-64/ipywidgets-0.0.1-np19py34_0.tar.bz2 , and I ssh'ed it onto the box. 我从列出的URL(网址为https://repo.continuum.io/pkgs/free/win-64/ipywidgets-0.0.1-np19py34_0.tar.bz2)下载了ipywidgets tarball,然后将其切入了包装盒。

What command can I run on the box (it is a Windows 7 environment) so that it will run the install as local, looking at the downloaded tarball to unpack rather than trying to access the internet to get the file? 我可以在包装盒(这是Windows 7环境)上运行什么命令,以便它将在本地运行安装,查看下载的tarball解压缩,而不是尝试访问Internet来获取文件?

Download the whole package and its dependencies to some local directory You can get it from PYPI ipywidgets 将整个软件包及其依赖项下载到本地目录中,您可以从PYPI ipywidgets获取

Let's consider you donwloaded from PYPI and you have ~/src/ipywidgets with ~/src/ipywidgets/setup.py which will have install_requires with a list of dep. 让我们考虑一下您是从PYPI下载的,并且具有~/src/ipywidgets~/src/ipywidgets/setup.py ,其中install_requires带有dep列表。 in your /pypi directory. /pypi目录中。 Like so: 像这样:

install_requires=['hello', 'etc', ...]

To install your app and its dep. 要安装您的应用程序及其部门。 into the current python env., you've to do something like: 到当前的python env中,您必须执行以下操作:

$ cd ~/src/ipywidgets
$ easy_install --always-unzip --allow-hosts=None --find-links=/pypi

Note that the build will fail if one or more dependencies are missing 请注意,如果缺少一个或多个依赖项,构建将失败

If you want to use conda for this, might as well if you are already using anaconda, you should also be able to do: 如果您想为此使用conda ,或者如果您已经在使用anaconda,那么也应该可以:

conda install --offline PATH_TO_FILE/ipywidgets-0.0.1-np19py34_0.tar.bz2

Where, of course, PATH_TO_FILE is just the path to the file you've downloaded. 当然, PATH_TO_FILE只是您下载的文件的路径。

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

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