简体   繁体   English

在Mac OS X 10.6.8上使用Homebrew安装Python 2.7之后,无法使用pip

[英]Trouble using pip after installing Python 2.7 with Homebrew on Mac OS X 10.6.8

I just used homebrew to install Python 2.7.2 on a clean Mac OS X Snow Leopard install, but seem to be having trouble getting PIP to work with it well. 我只是使用自制软件在干净的Mac OS X Snow Leopard安装上安装了Python 2.7.2,但似乎很难让PIP很好地与它一起工作。

Here are the steps that I took: 这是我采取的步骤:

  1. Installed python with Homebrew: brew install python --framework --universal 使用Homebrew brew install python --framework --universalbrew install python --framework --universal
  2. Updated my paths in my .zsrc 更新了我的.zsrc路径
  3. Made a symbolic link from /System/Library/Frameworks/Python.framework/Versions/Current to /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/Current /System/Library/Frameworks/Python.framework/Versions/Current/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/Current进行符号链接
  4. Used easy_install to install pip easy_install安装pip

These steps seem like they have worked: 这些步骤似乎奏效了:

$ brew doctor
Your system is raring to brew.

$ which python
/usr/local/bin/python

$ python --version
Python 2.7.2 

$ which easy_install
/usr/local/share/python/easy_install

$ which pip
/usr/local/bin/pip

However, when I try to install things with pip, for example $ pip install ipython I get this error message '/System/Library/Frameworks/Python.framework/Versions/2.6/share': Permission denied 但是,当我尝试使用pip安装东西时,例如$ pip install ipython我收到此错误消息'/System/Library/Frameworks/Python.framework/Versions/2.6/share': Permission denied

Why is pip still trying to install an old Python 2.6 location? 为什么pip仍然尝试安装旧的Python 2.6位置? How do I get it to install things to /usr/local/Cellar/python/2.7.2/ etc? 如何将其安装到/usr/local/Cellar/python/2.7.2/等目录?

Homebrewed Python now installs pip . 自制Python现在会安装pip

Since a while pip is installed directly into your homebrew-bin directory. 由于一会儿 pip直接安装到您的homebrew-bin目录中。

Therefore, $(brew --prefix)/bin/pip should be in your PATH , if your Homebrewbrew is set up correctly. 因此,如果正确设置了Homebrewbrew,则$(brew --prefix)/bin/pip应该位于PATH

So, it looks like the way that I installed things I needed to use /usr/local/share/python/pip-2.7 instead of /usr/local/share/python/pip . 因此,看起来就像我安装使用/usr/local/share/python/pip-2.7而不是/usr/local/share/python/pip所需的东西的方式。

Not sure why I have both pip and pip-2.7 but Aliasing my pip to the the 2-7 version seems to fix my issue. 不知道为什么我同时拥有pip和pip-2.7,但是将我的pip别名为2-7版本似乎可以解决我的问题。

Why are you using easy_install to install pip? 为什么要使用easy_install安装pip? Based on the path easy_install is probably pointing to Python 2.6, which results to pip point to 2.6 as well. 基于该路径,easy_install可能指向Python 2.6,结果pip也指向2.6。

Doesn't brew install pip fix this? brew install pip不能解决此问题吗?

Otherwise what you are doing looks correct 否则,您正在做的事情看起来正确

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM