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.
To check which version of a given package is installed, use the pip show <your_package> command. For example, to check the version of your NumPy installation or virtual environment, run pip show numpy in your command line or Powershell (Windows), or terminal (macOS and Linux/Ubuntu).
pip freeze might seem very useful initially but it can mess up your project because of the following reasons: It dumps all the libraries installed in your project including dependencies and sub-dependencies in the requirements. txt file. It still misses out on the libraries that are not installed using pip.
To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1. 3 .
You can use pip list --format=freeze
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With