Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/" and "/Library/Python/2.7/"

Tags:

python-2.7

I am working on a mac, a quick question, could someone told me the difference of these two directories?

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/

/Library/Python/2.7/site-packages/

like image 720
heghogbbb Avatar asked Feb 18 '23 12:02

heghogbbb


1 Answers

python.org

The installer from python.org installs to /Library/Frameworks/Python.framework/, and only that python executable looks in the contained site-package dir for packages.

/Library/Python

In contrast, the dir /Library/Python/2.7/site-packages/ is a global place where you can put python packages, all python 2.7 interpreter will. (For example the python 2.7 that comes with OS X).

~/Library/Python

The dir ~/Library/Python/2.7/site-packages, if it exists, is also used but for your user only.

sys.path

From within python, you can check, which directories are currently used by import sys; print(sys.path)

homebrew

Note, a python installed via homebrew, will put it's site-packages in $(brew --prefix)/lib/python2.7/site-packages but also be able to import packages from /Library/Python/2.7/site-packages and ~/Library/Python/2.7/site-packages.

like image 106
Samuel John Avatar answered May 19 '23 03:05

Samuel John