If you're doing more than one project on your machine then you need to concern yourself with dependencies across projects. In python the old-school way of doing this is to use virtualenv and pip. These tools get the job done, but they may have some caveats you should be aware of.
If we want to install
pandas we can run;
python -m pip install fastapi pandas
To install a specific version we could run;
python -m pip install fastapi==0.50.0
But we can also put our requirements in a file, like so:
pip will install the most recent version of a package
unless we tell it not to. In this example we're saying that
needs to be set exactly while numpy needs to be at least version 1.17.
Given such a file, say
requirements.txt, then we can also install
everything by running;
python -m pip install -r requirements.txt
If you wanted to check which python packages are installed you could run
python -m pip freeze
And if you want to narrow it down you can pipe the output of this command
grep to narrow it down.
python -m pip freeze | grep fastapi
Feedback? See an issue? Something unclear? Feel free to mention it here.
If you want to be kept up to date, consider getting the newsletter.