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. CCScrollView练习

    MyScrollItem是CCScrollView容器内项的接口,MyScrollView主要处理添加子节点和事件的处理,MyScrollViewTestItem是对MyScrollItem实现的测试 ...

  2. linux ubuntu 各目录大小

    /home 45k /bin 8.7M /lib 370M /mnt 4.1k /run 36k /sbin 11M /tmp 41k /usr/share 770M

  3. 封装request.get_params批量取值

    @json_request_validator(post_schema) 装饰器 from functools import wraps from schema import SchemaError ...

  4. 1028 Web Navigation

    题目链接: http://poj.org/problem?id=1028 题意: 模拟浏览器的前进/后退/访问/退出 的四个操作. 输出当前访问的URL或者Ignore(如果不能前进/后退). 分析: ...

  5. C# 时间戳的生成

    /**        * 生成时间戳,标准北京时间,时区为东八区,自1970年1月1日 0点0分0秒以来的秒数         * @return 时间戳        */        publi ...

  6. 多线程的那点儿事(之windows锁)

    在windows系统中,系统本身为我们提供了很多锁.通过这些锁的使用,一方面可以加强我们对锁的认识,另外一方面可以提高代码的性能和健壮性.常用的锁以下四种:临界区,互斥量,信号量,event. (1) ...

  7. Android新增的注解

    环境 使用Android注解前需要导入相关的包 compile 'com.android.support:support-annotations:latest.integration' 注意:如果我们 ...

  8. scala文件流操作,生成sparkpv,uv作业文件

    package com.bjsxt.scalaspark.core.examples.pvAnduv import java.io.Fileimport java.text.SimpleDateFor ...

  9. CodeForces 620E New Year Tree(线段树的骚操作第二弹)

    The New Year holidays are over, but Resha doesn't want to throw away the New Year tree. He invited h ...

  10. 【项目总结】扯一扯电商网站前端css的整体架构设计(1)

    最近半忙不忙的写了一个外包网站,网站主要功能是艺术品竞拍和艺术衍生品的销售.工程已经完成了80%左右,现在前后端代码量已经50W行左右,我主要负责的是前端设计和前端布局.下面就先放一个网站的设计图吧, ...