I do a lot of development without an internet connection1, so being able to install packages into a virtual environment without a connection to PyPI is pretty useful.
I've got a couple of aliases in my .bashrc which help with this2:
alias pipcache='pip install --download ${HOME}/.pip-packages'
alias pipinstall='pip install --no-index --find-links=file://${HOME}/.pip-packages/'
The first downloads the packages to my local cache, the second installs them from the cache.
Usage is probably fairly obvious:
pipcache Django==1.5 # Put Django-1.5.tar.gz in ~/.pip-packages
pipinstall Django==1.5 # Install ~/.pip-packages/Django-1.5.tar.gz

pipcache -r requirements.txt # Cache all the requirements of a project
pipinstall -r requirements.txt # Install all requirements from the cache
It's perfectly possible to cache multiple versions of the same package3, which is useful for being able to test upgrading to newer releases, whilst still being able to revert to the previously pinned package if you find nothing works.

Since I mostly use a fairly small set of packages, this means I can start up a brand new virtualenv and I'm very likely to have everything I need without going to PyPI. Not having to download large packages makes installs quicker too4.

pip安装本地文件的更多相关文章

  1. python中的各个包的安装,用pip安装whl文件

    在安装之前,一直比较迷惑究竟如何用,安装完后,发现竟然如此简单 首先我一般用的是python27,官网下载python27msi安装window7 64位后,已经自带了Pip 和 easy_insta ...

  2. python pip 安装库文件报错:pip install ImportError: No module named _internal

    解决方法: pip2.7, you can at first curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py then python2. ...

  3. windows下安装easy_install, pip 及whl文件安装方法

    转:http://www.cnblogs.com/wu-wenmin/p/4250330.html 写在前面的话 最近在看"Computer Vision with Python" ...

  4. 云服务器--linux系统操作命令以及安装ngnix记录,以及手动部署本地文件

    1.控制台登陆服务器,需要首先知道服务器ip和密码,,命令是 ssh root@1.1.1.1(服务器IP),然后输入密码登入服务器 2.查看linux 版本的系统命令是 cat /etc/redha ...

  5. paramiko模块的安装和使用(含上传本地文件或文件夹到服务器,以及下载服务器文件到本地)

    安装和使用分两步介绍: 介绍一下,本文的运行环境是win7 64位 和python 2.7  . 安装: WIN7_64位 安装python-ssh访问模块(paramiko)的安装教程,本人亲测下面 ...

  6. Python中怎样用pip安装外部主机文件

    在python中安装非自带python模块.有三种方式: easy_install pip 下载压缩包(.zip, .tar, .tar.gz)后解压, 进入解压缩的文件夹后运行python setu ...

  7. Git安装及密钥的生成并上传本地文件到GitHub上

    之前用的GitHub,不太熟练,一直在上传的过程中遇到了一些问题,看了网上诸多教程,总觉得很乱,特参考一些资料,总结了一篇完整的操作步骤,从下载安装到上传文件,亲测有效 1.下载Git软件:https ...

  8. 在windows下使用pip安装python包遇到缺失stdint.h文件的错误

    今天在windows上使用pip安装一个python包python-lzf时遇到如下的错误: fatal error C1083: Cannot open include file: 'stdint. ...

  9. 导出pip安装的所有放入一个文件中,并把通过这个安装所有的包

    导出pip安装的所有的包: pip freeze > piplist.txt 在新的环境中安装导出的包 pip install -r piplist.txt

随机推荐

  1. c#服务器端控件confirm

    1>服务器端控件删除的数据的时候,可以调用js的confirm防止误操作,但是默认的样式实在是让人难以接受,怎么调用自定义的提示框而且同步回发到服务器端, 服务器端的控件的用linkbutton ...

  2. TensorFlow全新的数据读取方式:Dataset API入门教程

    TensorFlow.data : http://tech.ifeng.com/a/20171109/44752505_0.shtml Pytorch:https://ptorch.com/docs/ ...

  3. 迁移ORACLE数据库文件到ASM

    迁移数据文件到ASM 数据库一致性情况下迁移:将数据库启动到mount状态,生成rman copy 语句,然后在rman中执行: SQL> startup mount SQL> selec ...

  4. 《深入理解Elasticsearch》README

    书目 <深入理解ElasticSearch>拉斐尔·酷奇,马雷克·罗戈任斯基[著]张世武,余洪森,商旦[译] 机械工业出版社,2016.1 本系列包括以下8篇笔记 第01章 Elastic ...

  5. 设置emacs启动窗口的两种方法

    1. 设置位置和大小 ;;设置窗口位置为屏库左上角(0,0) (set-frame-position (selected-frame) 0 0) ;;设置宽和高 (set-frame-width (s ...

  6. 编写高质量代码改善C#程序的157个建议——建议137:委托和事件类型应添加上级后缀

    建议137:委托和事件类型应添加上级后缀 委托类型本身是一个类,考虑让派生类的名字以基类名字作为后缀.事件类型是一类特殊的委托,所以事件类型也遵循本建议. 委托和事件的正确的命名方式有: public ...

  7. 慎用WSACleanup()

    中止Windows Sockets DLL的使用.         #include <winsock.h>         int PASCAL FAR WSACleanup ( voi ...

  8. 第二章第一个项目——package.json

    在其中写版本好的时候, { "name": "chatroom", "version": "0.0.1", " ...

  9. Linux系统优化及状态监控

    1.查看系统进程命令 top 进入后可按s 加时间,指定多长时间刷新一次 2.查看cpu信息 cat /proc/cpuinfo 3.查看内存信息 cat /proc/meminfo 4.清理内存:主 ...

  10. C#统计英文文本中的单词数并排序

    思路如下:1.使用的Hashtable(高效)集合,记录每个单词出现的次数2.采用ArrayList对Hashtable中的Keys按字母序排列3.排序使用插入排序(稳定) public void S ...