I record these tips mainly for future references, but I would be glad if you also find this post helpful. And if you have other pip tips, please comment and I will update this post.
A specific version:
pip install foo==1.2.0
A version range:
pip install 'bar>=1.3.2,<=1.5.4'
If the same package with a different version has already been installed, the
--force-reinstall should be used.
For multiple packages, it is better to use a
requirements.txt file. The syntax is just the same as the single-line version above.
foo==1.2.0 bar>=1.3.2,<=1.5.4 foobar
Then you can run:
pip install -r requirements.txt
pip install -i <mirror-url> foo
pip config set global.index-url <mirror-url>
This will ensure that you are using the correct
pip as long as you are using the correct