I do not understand my Python installation via Homebrew

I just installed Python using Homebrew. I used the brew install python command (after installing XQuartz, which is a prerequisite).

This page - https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python - tells me the following:

Questions

Assuming a standard Homebrew installation, the prefix will be /usr/local , and the basement will be /usr/local/Cellar .

Homebrew installs Python in the basement using the standard ./configure --prefix=#{prefix} .

This sets:

  • the site-packages folder, like /usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages .
  • the "install-scripts" folder is like /usr/local/Cellar/python/2.7.3/bin .

If site packages are in Python Cellar, then user-installed packages will be removed between Python updates. The same goes for install scripts, with an added issue that users must manually add to the Python basement basket in the folder to the path.

Decision

Homebrew performs two installation steps to solve these problems. questions.

  • First, the Cellar Sites folder is deleted and the symbolic link to /usr/local/lib/python2.7/site-packages in the prefix is ​​deleted. This will allow site packages to be kept between Python updates, as Homebrew has special handling for some languages ​​that use lib for user-installed libraries.

  • Secondly, the distutils.cfg file is written to install the installation scripts to the folder /usr/local/share/python . Users can add /usr/local/share/python to PATH to install installed scripts.

What I don’t understand is a line that says: "The Cellar sites folder is deleted and a symlink to /usr/local/lib/python2.7/site-packages in the prefix is ​​created." When I look at the "prefix" , which, as I understand it, is "/ usr / local", I do not see a symbolic link. Where is this referenced link?

One of the reasons I'm confused is that when I run pip install virtualenvwrapper , I get a conclusion that tells me: "The requirement has already been met: virtualenv-clone in / Library / Python / 2.7 / site-packages (from virtualenvwrapper) ". I do not understand where this /Library/Python/2.7/site-packages directory is /Library/Python/2.7/site-packages and why it is ever mentioned.

Having said that pip install virtualenvwrapper seems to end without problems and does not require sudo, which I think should be one of the advantages of installations that use Homebrew. All pip install virtualenvwrapper output:

  Downloading / unpacking virtualenvwrapper
   Running setup.py egg_info for package virtualenvwrapper

 Downloading / unpacking virtualenv (from virtualenvwrapper)
   Downloading virtualenv-1.8.2.tar.gz (2.2MB): 2.2MB downloaded
   Storing download in cache at ./Library/Caches/pip-downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fv%2Fvirtualenv%2Fvirtualenv-1.8.2.tar.gz
   Running setup.py egg_info for package virtualenv

     warning: no previously-included files matching '*' found under directory 'docs / _templates'
     warning: no previously-included files matching '*' found under directory 'docs / _build'
 Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /Library/Python/2.7/site-packages (from virtualenvwrapper)
 Requirement already satisfied (use --upgrade to upgrade): stevedore in /Library/Python/2.7/site-packages (from virtualenvwrapper)
 Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/local/lib/python2.7/site-packages/distribute-0.6.28-py2.7.egg (from stevedore-> virtualenvwrapper)
 Installing collected packages: virtualenvwrapper, virtualenv
   Running setup.py install for virtualenvwrapper

     Skipping installation of /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenvwrapper/__init__.py (namespace package)
     Installing /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenvwrapper-3.6-py2.7-nspkg.pth
     changing mode of /usr/local/share/python/virtualenvwrapper.sh to 755
     changing mode of /usr/local/share/python/virtualenvwrapper_lazy.sh to 755
   Running setup.py install for virtualenv

     warning: no previously-included files matching '*' found under directory 'docs / _templates'
     warning: no previously-included files matching '*' found under directory 'docs / _build'
     Installing virtualenv script to / usr / local / share / python
     Installing virtualenv-2.7 script to / usr / local / share / python
 Successfully installed virtualenvwrapper virtualenv
 Cleaning up ...
+4
source share
1 answer

From the updated documentation:

for Python 2.7.x, you will find it in / usr / local / lib / python 2.7 / site-packages.

Python 2.7 also looks for modules in:

/Library/Python/2.7/site-packages

~ / Library / Python / 2.7 / Library / python / site packages

So, you probably had an echo of a previously installed package in / Library / Python 2: 7 / site-packages

Homebrew recently hit 1.0, a lot has changed since you asked the question.

0
source

Source: https://habr.com/ru/post/1441122/


All Articles