点冻结与点列表 [英] Pip freeze vs. pip list

查看:84
本文介绍了点冻结与点列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比较输出结果会发现差异:

A comparison of outputs reveals differences:

user@user-VirtualBox:~$ pip list
feedparser (5.1.3)
pip (1.4.1)
setuptools (1.1.5)
wsgiref (0.1.2)
user@user-VirtualBox:~$ pip freeze
feedparser==5.1.3
wsgiref==0.1.2

Pip的文档说明

freeze                      Output installed packages in requirements format.
list                        List installed packages.

但是什么是需求格式"?为什么pip list生成比pip freeze更全面的列表?

but what is "requirements format," and why does pip list generate a more comprehensive list than pip freeze?

推荐答案

使用virtualenv时,可以指定requirements.txt文件来安装所有依赖项.

When you are using a virtualenv, you can specify a requirements.txt file to install all the dependencies.

典型用法:

$ pip install -r requirements.txt

对于pip,软件包必须采用特定的格式,即

The packages need to be in a specific format for pip to understand, which is

feedparser==5.1.3
wsgiref==0.1.2
django==1.4.2
...

这是要求格式".

在这里,django==1.4.2意味着安装django版本1.4.2(即使最新版本是1.6.x). 如果未指定==1.4.2,将安装可用的最新版本.

Here, django==1.4.2 implies install django version 1.4.2 (even though the latest is 1.6.x). If you do not specify ==1.4.2, the latest version available would be installed.

您可以在" Virtualenv和pip基础知识", 以及正式的"需求文件格式"文档.

You can read more in "Virtualenv and pip Basics", and the official "Requirements File Format" documentation.

这篇关于点冻结与点列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆