2

I am looking to install django-extensions and its dependancies (particularly six) without ever hitting the internet. I have the tarballs for both django-extensions and six, so am able to install offline. However, I see in my logs that pip firsts tries to find six on pypi before checking locally. Instead, I want to force the installer to never check pypi.

Log output (this is before I downloaded the six tarball, so please ignore the local packages error)

Installed /usr/local/lib/python2.7/site-packages/django_extensions-1.2.5-py2.7.egg

Processing dependencies for django-extensions==1.2.5

Searching for six

Reading http://pypi.python.org/simple/six/

Download error: [Errno -3] Temporary failure in name resolution -- Some packages may not be found!

Couldn't find index page for 'six' (maybe misspelled?)

Scanning index of all packages (this may take a while)

Reading http://pypi.python.org/simple/

Download error: [Errno -3] Temporary failure in name resolution -- Some packages may not be found!

No local packages or download links found for six

4

2 回答 2

0

你可以尝试:

1) 解压压缩包并在解压的目录中执行python setup.py install

2)或者如果你想坚持使用 pip,首先你必须下载 pip 包:pip install --download /temp_download_dir package_name==version (“==version”是可选的)你可以安装 pip 包pip install - -no-index --find-links /temp_download_dir 包名

于 2014-02-06T07:04:00.780 回答
0

您的问题的简单答案是将--no-index选项传递给pip,这将避免检查包的索引。

您确实需要设置一个本地pypi镜像并指向pip该镜像。这就是我在工作中限制机器访问 Internet 时所做的事情。它可能会变得有点复杂,因为它需要设置一个 Web 服务器(请参阅这个博客pypiserver,其中讨论了根据pep-381设置镜像)。

如果这不是您的选择,最简单的方法是使用basket. 安装后(使用pip),只需要求它下载软件包:

$ basket init # initialize the directory
Repository has been created: ~/.basket
$ basket download django-extensions # this will download any dependencies as well

然后,将~/.basket目录移动到没有 Internet 的计算机上,然后运行:

pip install --no-index -f file:///path/to/.basket django-extensions
于 2014-02-06T07:21:28.257 回答