如何脱机安装ipywidgets(从文件)

时间:2016-06-14 17:32:20

标签: python cmd anaconda jupyter-notebook ipywidgets

所以我试图将ipywidgets-0.0.1安装到我的Anaconda环境中。我正在运行Anaconda3。不幸的是,我需要安装它的机器没有互联网访问。

安装软件包的基本方法是运行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

这是有道理的,因为该框无法访问互联网。 我从https://repo.continuum.io/pkgs/free/win-64/ipywidgets-0.0.1-np19py34_0.tar.bz2列出的URL下载了ipywidgets tarball,然后我把它打到了盒子里。

我可以在盒子上运行什么命令(它是Windows 7环境),以便它将以本地方式运行安装,查看下载的tarball以解压缩而不是尝试访问互联网来获取文件?

2 个答案:

答案 0 :(得分:2)

将整个包及其依赖项下载到某个本地目录 您可以从PYPI ipywidgets

获取

让我们考虑您从PYPI中下载,~/src/ipywidgets ~/src/ipywidgets/setup.py install_requires/pypi列表为dep。在您的install_requires=['hello', 'etc', ...]目录中。像这样:

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

安装您的应用及其dep。进入当前的python环境,你要做的事情如下:

<form id="testform" name="entform" onsubmit="return promptChar()" method="post">
 <input id="input-text" name="entchar" type="text" placeholder="Enter Text" />
 <input type="submit" value="Send" />
</form>

<script>
 (function(){

  function promptChar(){
  var field = document.getElementById('input-text').value;

   if(field == "a"){
    alert('hey');
    return false
   }
  }
 })();
</script>

请注意,如果缺少一个或多个依赖项,构建将失败

答案 1 :(得分:0)

如果你想使用conda,如果你已经在使用anaconda,你也应该能够这样做:

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

当然,PATH_TO_FILE只是您下载文件的路径。