我不明白我通过Homebrew安装Python

时间:2012-10-21 16:41:47

标签: python homebrew

我刚刚使用Homebrew安装了Python。我使用了命令brew install python(在安装XQuartz之后,这是一个先决条件)。

此页面 - https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python - 告诉我以下内容:

  

问题

     

假设安装了标准的Homebrew,前缀将是   /usr/local和酒窖将是/usr/local/Cellar

     

自制软件使用标准./configure --prefix=#{prefix}将安装到Cellar      

设置:

     
      
  • “site-packages”文件夹为   /usr/local/Cellar/python/2.7.3/lib/python2.7/site-packages
  •   
  • 将“install-scripts”文件夹设为/usr/local/Cellar/python/2.7.3/bin
  •   
     

如果site-packages存在于Python的Cellar中,那么用户安装的包   将在Python更新之间擦除。对于安装脚本也是如此   用户必须手动添加Python窖藏的附加问题   文件夹到路径。

     

解决方案

     

Homebrew在安装时执行两个操作来解决这些问题   的问题。

     
      
  • 首先,删除Cellar site-packages文件夹,并删除符号链接   创建前缀中的/usr/local/lib/python2.7/site-packages。这个   将允许站点包在Python更新之间保持不变,如   Homebrew对某些使用lib的语言进行了特殊处理   用户可安装的库。

  •   
  • 其次,编写distutils.cfg文件来设置安装脚本   文件夹到/usr/local/share/python。用户可以添加   /usr/local/share/python PATH选择已安装的脚本。

  •   

我不明白的是“删除了Cellar site-packages文件夹,以及符号链接”的行 创建前缀中的/usr/local/lib/python2.7/site-packages。“当我查看”前缀“ - 我理解为'/ usr / local'时 - 我没有看到符号链接。这个符号链接在哪里被引用到吗

我感到困惑的一个原因是,当我运行pip install virtualenvwrapper时,我得到的输出告诉我:“要求已经满足:virtualenv-clone in /Library/Python/2.7/site-packages(来自virtualenvwrapper) ”。我不明白这个/Library/Python/2.7/site-packages目录的来源以及它被引用的原因。

话虽如此,pip install virtualenvwrapper确实似乎完成没有问题,并且不需要sudo,我认为这应该是使用Homebrew的安装的优势之一。 pip install virtualenvwrapper的整个输出是:

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...

1 个答案:

答案 0 :(得分:0)

From the updated documentation:

  

对于Python 2.7.x,您可以在/usr/local/lib/python2.7/site-packages找到它。

     

Python 2.7还在以下位置搜索模块:

     

/Library/Python/2.7/site-packages

     

〜/库/ Python的/ 2.7 / LIB /蟒/站点包

所以,你可能在/ Library / Python2:7 / site-packages

中回应了以前安装的软件包

Homebrew最近达到了1.0,自你提出这个问题以来已经发生了很多变化。