在Mac上安装python3后,pip无法正常工作

问题描述:

我从官方网站安装了python3,然后安装了jupyter笔记本.尝试运行jupyter笔记本时,出现找不到命令"错误.

I installed python3 from the official website and then installed jupyter notebook. While trying to run jupyter notebook, I was getting a "command not found" error.

我发现了此github问题,并按照说明删除了python3并使用重新安装而是使用Homebrew(我以前使用过Homebrew).

I found this github issue and followed the instructions to delete python3 and reinstall using Homebrew instead (I've used Homebrew before).

尝试python3 -m pip install --upgrade pip时,出现没有名为pip的模块"错误.我的/usr/local/bin/文件显示了pip,pip2,pip2.7,pip3,pip3.6.

When trying python3 -m pip install --upgrade pip i get a "No module named pip" error. My /usr/local/bin/ file shows pip, pip2, pip2.7, pip3, pip3.6.

我感到我的点子与我使用Homebrew安装的python3没有关联.我该如何解决?

I have a feeling my pip is not associated with the python3 that I installed using Homebrew. How can I fix this?

当您在机器上有很多混乱时,这种方法是一种非常简单的方法来为特定的python解释器安装pip:

This way is a pretty fool-proof way to install pip for a specific python interpreter, when you have a big mess of them on the machine:

$ curl https://bootstrap.pypa.io/get-pip.py > /tmp/get_pip.py
$ my_python_interpreter /tmp/get_pip.py

然后:

$ my_python_interpreter -m pip install some_dist