关于python:如何在我的Mac上安装pip3?

How to install pip3 on my Mac?

我想安装pip3,但我运气不好。另外,我试过sudo install,但没用。如何在Mac上安装PIP3?

1
2
3
4
5
6
7
8
9
10
sudo easy_install pip3
Password:
Searching for pip3
Reading https://pypi.python.org/simple/pip3/
Couldn't find index page for 'pip3' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/

No local packages or download links found for pip3
error: Could not find suitable distribution for Requirement.parse('
pip3')


更新-1.5之后的自制版本

根据官方自制网页:

On 1st March 2018 the python formula will be upgraded to Python 3.x and a python@2 formula will be added for installing Python 2.7 (although this will be keg-only so neither python nor python2 will be added to the PATH by default without a manual brew link --force). We will maintain python2, python3 and python@3 aliases.

因此,要安装python 3,请运行以下命令:

1
brew install python3

然后,自动安装pippip3,您可以通过pip install 安装任何软件包。

旧版本的自制啤酒不仅是brew install python3,还有brew postinstall python3

所以你必须跑:

1
2
brew install python3
brew postinstall python3

注意,您应该检查控制台,因为它可能会出错,在这种情况下,没有安装pip3


你可以用自制啤酒

然后运行:

1
brew install python3


我用这些命令解决了同样的问题:

1
2
curl -O https://bootstrap.pypa.io/get-pip.py
sudo python3 get-pip.py


对我来说,brew postinstall python3不起作用。在Github自制问题页面找到此解决方案:

1
2
3
4
$ brew rm python
$ rm -rf /usr/local/opt/python
$ brew prune
$ brew install python3


python3运行成功,但没有pip3。尝试了StackOverflow、Quora和其他公司的许多建议。(大量安装和卸载)

python3总是很好,但是没有pip3。最后,我从以下网站下载了python3:https://www.python.org/下载/

通过简单的鼠标点击,一切(python3+pip3)现在都正常工作了。


要安装或升级pip,请从官方网站下载get-pip.py。然后运行以下命令:

1
sudo python get-pip.py

它将为运行脚本的python版本安装pip


我在下面运行,其中:与其他:匹配,以获取/usr/local/lib/python3.7/site-packages/目录中的其他文件:

1
2
sudo chown -R <user>:<group> /usr/local/lib/python3.7/site-packages/pip*
brew postinstall python3

类似于Oksana,但添加python3

1
2
3
4
5
6
7
$ brew rm python
$ brew rm python3
$ rm -rf /usr/local/opt/python
$ rm -rf /usr/local/opt/python3
$ brew prune
$ brew install python3
$ brew postinstall python3

现在似乎适用于Mac OS X 10.13.3 Xcode 9.2下的Pip3