Lowan
Lowan

Reputation: 417

pip freeze doesn't show package version

Over the weekends I have upgraded my Ubuntu to 20.04, and I tried creating virtualenvironment with python 3.8.2, and pip install requirements.txt. In requirement.txt, I am installing some code from private gitlab repositories.

Previously, if I do pip freeze, I was able to see all packages name and version (formatted as package_name == version.

However, if I do pip freeze, now I see something like this...

pkg1 @ file:///tmp/tmp44ir_jik
pkg2 @ file:///tmp/tmp5pijtzbq
...

(pkg1 and pkg2 are both from pip installing private git repo)

I would like to somehow display the version, but don't know how to.

I mean, pip list does show the version, but I am writing a script and would like to use pip freeze for it. How can I get pip freeze to show how it use to before (with the format as pkg_name==pkg_version)?

Thanks in advance.

Upvotes: 28

Views: 9599

Answers (2)

I could not comment to answer the question by Iowan above; thus is redundant to the answer by X Æ A-13:

 pip list --format=freeze > requirements.txt

Upvotes: 9

X Æ A-Xiii
X Æ A-Xiii

Reputation: 636

You can use pip list --format=freeze instead.

Upvotes: 40

Related Questions