如何在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:
- 从pypi下载pyserial
- untar pyserial.tgz
- cd pyserial
-
python3 setup.py install
- Download pyserial from pypi
- untar 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