4

I installed pip3 using "brew install python3" on mac.

brew install python3

Warning: python@3.9 3.9.2_1 is already installed and up-to-date.
To reinstall 3.9.2_1, run:
  brew reinstall python@3.9

python3 --version

returns, Python 3.8.2

I dont know how to change it to point to version 3.9.2 the latest version.

Now, I have the following in requirements.txt,

sklearn
pandas

pip3 install -r requirements.txt

Gives the following error.

Traceback (most recent call last):
  File "/Library/Developer/CommandLineTools/usr/bin/pip3", line 6, in <module>
    from pip._internal import main
ModuleNotFoundError: No module named 'pip'

Am new to python and not sure how to fix it.

user1578872
  • 7,808
  • 29
  • 108
  • 206

2 Answers2

2

Download the get-pip.py file and store it in the same directory as python is installed. or

Use the following command to download pip directly.

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Now execute the downloaded file using below command

python3 get-pip.py

Verification of the Installation process:

One can easily verify if the pip has been installed correctly by performing a version check on the same. Just go to the command line and execute the following command:

pip3 --version

saipy
  • 25
  • 6
0

For MacOS what helped me is the complete reinstallation of the python3 with brew:

brew uninstall python3  # if python3 worked before
brew install python3

Then the pip started to work again as before.

Alex Medveshchek
  • 501
  • 4
  • 12