在OS X上安装pip

16
我希望在OS X上安装pip。因此,我下载并安装了Python 3.4,并随后使用由Python Packaging Authority提供的脚本安装了pip;但是当我运行pip时,出现“command not found”的错误提示。
MacBook-Pro-de-paquirrin:Home paquirrin$ sudo curl -O https://bootstrap.pypa.io/get-pip.py
Password:
Sorry, try again.
Password:
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1487k  100 1487k    0     0   783k      0  0:00:01  0:00:01 --:--:--  783k
MacBook-Pro-de-paquirrin:Home paquirrin$ sudo python3 get-pip.py
The directory '/Users/paquirrin/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/paquirrin/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)
    100% |████████████████████████████████| 1.2MB 718kB/s 
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |████████████████████████████████| 71kB 1.6MB/s 
Installing collected packages: pip, wheel
  Found existing installation: pip 6.0.8
    Uninstalling pip-6.0.8:
      Successfully uninstalled pip-6.0.8
Successfully installed pip-8.1.1 wheel-0.29.0
MacBook-Pro-de-paquirrin:Home paquirrin$ sudo pip install awsebcli
sudo: pip: command not found

sudo pip3 install awsebcli 能正常工作吗? - snakecharmerb
2
重复问题,参见https://dev59.com/SWQm5IYBdhLWcg3w4CIN - iSkore
1
不使用brew的解决方案:sudo easy_install pip - Vishal
大多数情况下,Python安装时会自动安装pip。pip2 install <your_module_name> 应该可以正常工作。 - Abraham Jagadeesh
2个回答

20

我发现最简单的方法是使用Homebrew,它会安装所有基本的Python和pip工具。但你也可以随意使用MacPorts。

brew install python

我使用了这篇帖子中的答案,如果需要更多帮助:如何在 macOS 或 OS X 上安装 pip?


2
最佳答案是,在尝试创建别名、安装brew python和运行sudo python get-pip.py之后,使用sudo easy_install pip非常容易。 - Oleksii Kyslytsyn

11

不知道,但是看起来这篇交叉栏安装教程完全涵盖了你的主题。

此外:你可以在本地安装pip。尝试从你执行curl命令的文件夹中使用bin/pip


1
谢谢。它对我有用 :) - Woppi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接