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. 28-组合数(dfs)

    http://acm.nyist.edu.cn/JudgeOnline/problem.php?pid=32 组合数 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述 ...

  2. code4511 信息传递

    寻找最小环 #include <cstdio> #include <cstring> #include <iostream> using namespace std ...

  3. [GO]并发的网络爬虫

    package main import ( "fmt" "strconv" "net/http" "os" " ...

  4. 【转载】mysql中timestamp,datetime,int类型的区别与优劣

    转载来自souldak,微博:@evagle以下内容整合筛选自互联网: int1. 占用4个字节2. 建立索引之后,查询速度快3. 条件范围搜索可以使用使用between4. 不能使用mysql提供的 ...

  5. Java 代理模式(一) 静态代理

    转自: http://www.cnblogs.com/mengdd/archive/2013/01/30/2883468.html 代理模式 代理模式的作用是:为其他对象提供一种代理以控制对这个对象的 ...

  6. APUE(4)---文件和目录 (2)

    七.函数umask umask函数为进程设置文件模式创建屏蔽字,并返回之前的值,这是少数几个没有出错返回函数中的一个.其中cmask是9个常量(S_IR/W/XUSR.S_IR/W/XGRP.S_IR ...

  7. [LeetCode 题解]: First Missing Positive

    Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0]  ...

  8. [LeetCode 题解]: Count and Say

    The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...

  9. SlidesJS基本使用方法和官方文档解释

    Slides – 是一个简单的,容易定制和风格化,的jQuery幻灯片插件. Slides提供褪色或幻灯片过渡效果,图像淡入淡出,图像预压,自动生成分页,循环,自动播放的自定义等很多选项. 用Slid ...

  10. Backup--BUFFERSIZE 和BUFFERCOUNT

    在备份时,可以通过设置BUFFERSIZE 和BUFFERCOUNT来控制备份的时间和CPU的消耗 使用TF 3605 和 TF 3213 来显示备份使用的 BUFFERCOUNT DBCC TRAC ...