如何在Mac OS X上为Python 3安装pip? [英] How to install pip for Python 3 on Mac OS X?

查看:658
本文介绍了如何在Mac OS X上为Python 3安装pip?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OS X(Mavericks)已安装Python 2.7库存.但是我用3.3来做我自己的所有Python个人资料.我刚刚冲洗了3.3.2安装并安装了新的3.3.3.因此,我需要再次安装pyserial.我可以按照以前做的方式来做,即:

OS X (Mavericks) has Python 2.7 stock installed. But I do all my own personal Python stuff with 3.3. I just flushed my 3.3.2 install and installed the new 3.3.3. So I need to install pyserial again. I can do it the way I've done it before, which is:

  1. 从pypi下载pyserial
  2. untar pyserial.tgz
  3. cd pyserial
  4. python3 setup.py install
  1. Download pyserial from pypi
  2. untar pyserial.tgz
  3. cd pyserial
  4. python3 setup.py install

但是我想像酷孩子一样做,只是做类似pip3 install pyserial的事情.但目前尚不清楚我要如何做到这一点.就这一点. (除非我必须)对virtualenv不感兴趣.

But I'd like to do like the cool kids do, and just do something like pip3 install pyserial. But it's not clear how I get to that point. And just that point. Not interested (unless I have to be) in virtualenv yet.

推荐答案

更新:Python3.4不再需要此功能.它会在库存安装中安装pip3.

UPDATE: This is no longer necessary with Python3.4. It installs pip3 as part of the stock install.

我最终在python邮件列表上发布了同样的问题,并得到了以下答案:

I ended up posting this same question on the python mailing list, and got the following answer:

# download and install setuptools
curl -O https://bootstrap.pypa.io/ez_setup.py
python3 ez_setup.py
# download and install pip
curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py

哪个完美地解决了我的问题.在为我自己添加以下内容之后:

Which solved my question perfectly. After adding the following for my own:

cd /usr/local/bin
ln -s ../../../Library/Frameworks/Python.framework/Versions/3.3/bin/pip pip

为了能够直接运行pip,我能够:

So that I could run pip directly, I was able to:

# use pip to install
pip install pyserial

或:

# Don't want it?
pip uninstall pyserial

这篇关于如何在Mac OS X上为Python 3安装pip?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆