Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to pick a particular version from requirement.txt file

Tags:

python

I have requirements.txt file, where I give the custom-package name with version as below,

custom-package >= 1.0.1

Now in my repo, i have versions like below

custom-package-1.0.1.tar.gz
custom-package-1.0.4.tar.gz
custom-package-5.0.0.tar.gz

now if I run pip install requirements.txt , then it picks up 5.0.0. which is understandable. But how can I make sure, it should only pick up the version starts with 1 not with 5.

like image 501
change198 Avatar asked Jan 31 '26 05:01

change198


1 Answers

If you want any version that starts with 1, just specify that the version shouldn't exceed 2.0.0:

custom-package >= 1.0.1, < 2.0.0

or if you want an exact version:

custom-package == 1.0.1
like image 148
Amin Guermazi Avatar answered Feb 02 '26 18:02

Amin Guermazi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!