简体   繁体   中英

how to pick a particular version from requirement.txt file

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.

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

If you want to choose any version starting with '1', just do:

custom-package == 1.*
custom-package==1.*

This should do

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM