点冻结-本地 [英] Pip freeze --local
问题描述
我正在观看视频教程,而那个家伙是这样做的:
I am following a video tutorial and that guy did this:
$ pip freeze --local > requirement.txt
$ cat requirement.txt
这是将所有这些软件包及其版本导出到另一个项目中,但是如何:
this is to export all these packages with their versions in another project, but how:
- 什么是
点冻结
?和 - 那是什么
requirement.txt
?我们应该将所有这些软件包导出到txt文件中,.txt文件如何做到这一点呢? -
第二行中的
cat
一词是什么?我的机器无法理解其中任何一个,但是我的机器说,它们在他的计算机上正在工作:
- what is
pip freeze
? and - what is that
requirement.txt
? are we supposed to export all those packages in a txt file, how can .txt file do that does it grab their name? what is the word
cat
in second line? my machine can't understand either of those, but in his computer they were working, my machine says:
如您所见, cat
无法识别.
然后我在virtualenv目录中搜索require.txt,然后找到了
Then I look in virtualenv directory to search for requirement.txt and I find this
是的, requirement.txt
是零字节,其中没有任何内容.有什么问题吗?
Yes, requirement.txt
is zero bytes, nothing in it.
What is the problem?
接下来,我搜索了什么是 pip Frozen
和什么是 cat
?我找不到关于cat的简单定义.但这是 pip冻结
Next I googled for what is pip freeze
and what is cat
? I couldn't find a simple definition for cat. but here is pip freeze
用法:点子冻结[选项]说明将安装的软件包输出到需求格式.
Usage : pip freeze [options] Description Output installed packages in requirements format.
软件包以不区分大小写的排序顺序列出.
packages are listed in a case-insensitive sorted order.
什么是需求格式"?那是文本文件吗?
What is "requirements format"? Is that a text file?
然后我在堆栈溢出中遇到了这个问题:如何冻结仅在虚拟环境中安装的软件包?
Then I came to this question in Stack Overflow: How to freeze packages installed only in the virtual environment?
他是说我该如何在虚拟环境中用冰层保存包裹?
Does he means how do I preserve packages with a layer of ice in my virtual environment?
推荐答案
Pip是Python模块的软件包管理器.命令 pip Frozen
输出所有已安装的模块(包括版本号).-local
标志可防止Pip在虚拟环境中打印全局安装的软件包.
Pip is a package manger for Python modules. The command pip freeze
outputs all installed modules (including version numbers). The --local
flag prevents Pip from printing globally installed packages in a virtual environment.
通常,Python程序依赖于其他模块.您可以将这些必需的模块放在一个文本文件中(按惯例是 requirements.txt
),以便其他人可以通过运行 pip install -r要求来安装这些依赖项.txt
.您可以使用 pip冻结
方便地创建此类文件.
Usually, a Python program depends on other modules. You can put those required modules in a text file (requirements.txt
by convention) so that other people can install those dependencies by running pip install -r requirements.txt
. You can conveniently create such a file using pip freeze
.
在Linux机器上, cat
用于输出文件的内容.您可以在Windows上使用 type
.
On a Linux machine, cat
is used to output the contents of a file. You can use type
on Windows.
需求格式如下:
docutils==0.11
Jinja2==2.7.2
MarkupSafe==0.19
Pygments==1.6
Sphinx==1.2.2
每行包含一个python模块名称和一个相应的版本.
Each lines consist of a python module name and a corresponding version.
https://pip.pypa.io/en/stable/reference/pip_freeze/
https://pip.readthedocs.io/en/1.1/requirements.html
这篇关于点冻结-本地的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!