Lets say I have a reqirement.txt file which has this content (real file has more modules).
azure==4.0.0
google==3.0.0
requests==2.27.1
pyshark==0.4.5
pymysql==1.0.2
pandas==1.1.5
Okay, I install these packages using pip3 install -r requirements.txt
Next time when I want to run this command again, requirements file looks like this (updated pandas and added 2 more):
azure==4.0.0
google==3.0.0
requests==2.27.1
pyshark==0.4.5
pymysql==1.0.2
pandas==1.4.3
google-api-python-client==2.52.0
pytest-check==1.0.4
So, next time when i run the pip command i don't want to uninstall/install modules that i have not changed the version. Is there a way to run this command with a logic that if the version is the same, do nothing, if it is different uninstall old/install new, if it doesn't exist install it.
I know that there is --ignore-installed flag, but based on this answer here, it is risky to use