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

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

问题描述

输出的比较揭示了差异:

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天全站免登陆