-3

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:

  • 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:

    enter image description here

    As you can see cat is not recognized.

Then I look in virtualenv directory to search for requirement.txt and I find this

enter image description here

Yes, requirement.txt is zero bytes, nothing in it. What is the problem?

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?

Asif
  • 1,538
  • 3
  • 10
  • 17
  • 1
    `cat` is a Linux command: http://man7.org/linux/man-pages/man1/cat.1.html – jonrsharpe Feb 28 '19 at 17:39
  • You might find the [Django Girls tutorial](https://tutorial.djangogirls.org/en/) useful. It gives Windows versions of the commands, and explains the reasons for lots of steps so hopefully you won't get sidetracked too much. – Alasdair Feb 28 '19 at 17:47
  • None of that has anything to do with Python or Django - `pip freeze` dumps a list of your Python packages into the file you specify, you will need this when deploying a project but it's pointless before you even start developing. `cat` just outputs the contents of the file to the terminal, and this command only works on Unix-based systems (eg Linux), not Windows. If you're completely new to Python I would advise to learn the basics of the language first, including using `pip` and virtual environments, then learn Django when you're comfortable with Python. – Robin Zigmond Feb 28 '19 at 17:49
  • All the information you are asking for is very easy to find by simple google searches. There is extensive documentation for all those tools. I doubt you have spend enough time to try and find the answers to your questions on your own. – trixn Feb 28 '19 at 17:54
  • Thank you everyone! Looks like I have to do a full 10 hours search before asking any question in here. – Asif Feb 28 '19 at 18:04
  • is something wrong with this question? why the downvotes? – Ulf Gjerdingen Jun 25 '19 at 10:50

2 Answers2

7

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.

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.

On a Linux machine, cat is used to output the contents of a file. You can use type on Windows.

The requirements format looks like this:

docutils==0.11
Jinja2==2.7.2
MarkupSafe==0.19
Pygments==1.6
Sphinx==1.2.2

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

Scriptim
  • 1,743
  • 2
  • 20
  • 37
  • Thank you so much. Understanding requirement.txt helped me figure out what is going on in here ! – Asif Feb 28 '19 at 18:02
0

Working: cat requirements.txt 's' - at the end...

Vladimir
  • 1
  • 1