Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip failling to install for Python 3.7 on MacOs

Tags:

python

macos

pip

I'm currently working on a Mac with Mojave. I have successfully installed python 3.7 with brew

    brew install python3

But I have tried several methods to install pip for python 3.7 (installing with get-pip.py, easy_install pip, etc.), which had worked for installing pip in the python 2.7 folder, but not in the python 3.7.

Currently when I call

  pip --version

I get

pip 18.1 from /Library/Python/2.7/site-packages/pip (python 2.7)

And pip3 seems not to exist.

How can I get pip3 installed in the python 3.7 folder? Thanks!

like image 278
PthaloDev Avatar asked Oct 29 '18 09:10

PthaloDev


People also ask

How do I install Python 3.7 on Mac?

Install Python 3 with the Official Installer First, download an installer package from the Python website. To do that, visit https://www.python.org/downloads/ on your Mac; it detects your operating system automatically and shows a big button for downloading the latest version of Python installer on your Mac.

Why is pip install not working in Python?

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.

Why pip is not working in Terminal Mac?

Sometimes when you are installing packages, you might face the error: pip: command not found . This error could be due to the following reasons: Pip is not installed. Pip is installed, but it is not compatible with the current environment.

How do I install pip on Mac Python 3?

To install PIP using ensurepip:Open the Mac Terminal app via the Launchpad. In the Terminal, type python -m ensurepip or python3 -m ensurepip and press Enter. If PIP is missing, ensurepip will install PIP. Follow any additional on-screen instructions to complete this process.


3 Answers

If you want to ensure pip installed for python 3.7, try something like this:

wget https://bootstrap.pypa.io/get-pip.py
sudo python3.7 get-pip.py
like image 138
Antwane Avatar answered Oct 19 '22 11:10

Antwane


Ok, so I still don't quite understand what's going on with pip3 in my device, but I found a way to install packages with pip in the right Python version:

python3 -m pip install [package]

It worked to install numpy which was my primary objective.

like image 21
PthaloDev Avatar answered Oct 19 '22 10:10

PthaloDev


Maybe you're using an older version of Brew?

In that case run brew postinstall python3

like image 1
Rupaksh Paul Avatar answered Oct 19 '22 10:10

Rupaksh Paul