On the brand new MacOS 13 M1/M2, python 3.9 is pre-installed with pip3 (no pip). I do not set up different Python variations with brew/macport or Python installer, solely the pre-install 3.9.
With the pre-install python, the worldwide site-package is positioned in /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Variations/3.9/lib/python3.9/site-packages
The per-user site-package is positioned in ~/Library/Python/3.9/lib/python/site-packages
Once I pip3 set up a package deal, it is going to be put in to the per-user location, not the worldwide location, together with the executable recordsdata put in ~/Library/Python/3.9/bin
. For instance, after I improve pip3, pip may even be put in in ~/Library/Python/3.9/bin
.
Ought to I set PYTHONPATH
to ~/Library/Python/3.9/bin
and add PYTHONPATH to PATH? My purpose is to run these executable recordsdata put in by pip3 with out specifying the total path. Once I upgraded pip3 the system nonetheless complained it could not discover pip, and it took me a while to determine why.
I can add ~/Library/Python/3.9/bin
to PATH immediately however I really feel it’s an advert hoc resolution. For instance, with the following macOS launch, the pre-installed Python could improve to three.10 (as that occurred earlier than) I might have so as to add ~/Library/Python/3.10/bin to PATH too. I wish to know what’s the finest follow for utilizing PYTHONPATH/PYTHONHOME
for the pre-install python on Mac.
Each PYTHONPATH/PYTHONHOME
will not be set by default.
From What precisely needs to be set in PYTHONPATH?, the agreed-upon solutions are that I need not set PYTHONPATH except there are non-standard libraries I need to use. However these solutions appear to not remedy my drawback, in fact, I want to make use of non-standard libraries for my growth, say pytorch.