Quantcast
Channel: Install a package and write to requirements.txt with pip - Stack Overflow
Viewing all articles
Browse latest Browse all 4

Install a package and write to requirements.txt with pip

$
0
0

I'm searching for a way to install a package with pip, and write that package's version information to my project's requirements.txt file. For those familiar with npm, it's essentially what npm install --save does.

Using pip freeze > requirements.txt works great, but I've found that I forget to run this, or I can accidentally include unused packages that I'd installed for testing but decided not to use.

So the following psuedocode:

$ pip install nose2 --save

Would result in a requirements.txt file with:

nose2==0.4.7

I guess I could munge the output of save to grab the version numbers, but I am hoping there is an easier way.


Viewing all articles
Browse latest Browse all 4

Trending Articles





<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>