如何在 Mac OS X 上为 Python 3 安装 pip? [英] How to install pip for Python 3 on Mac OS X?
问题描述
OS X (Mavericks) 安装了 Python 2.7 stock.但是我用 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:
- 从pypi下载pyserial
- 解压 pyserial.tgz
- cd pyserial
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屋!