I recently updated to Catalina and the default zsh. I probably messed up paths during the transition, and I'm currently trying to sort out the locations of Python3.7, pip3, the command-line PATH and my zshrc file.
It looks as if there are potentially redundant files contained within /usr/bin, /usr/local/bin, /usr/local/Cellar/python and /Users/[user]/.local/bin
The following are reproductions of commands:
$ which python3
/usr/bin/python3
$ which python
/usr/bin/python
$ which pip
pip not found
$ which pip3
/usr/bin/pip3
$ pip3 -V
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/usr/bin/pip3", line 10, in <module>
sys.exit(main())
TypeError: 'module' object is not callable
$ cat ~/.zshrc
export PATH=$PATH:/usr/local/bin:/usr/bin
$ echo $PATH
/Users/[user]/.local/bin:/bin:/usr/bin:/usr/local/bin:/Users/[user]/anaconda3/bin:/Users/[user]/anaconda3/bin:/Users/[user]/.local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/[user]/anaconda3:/Library/TeX/texbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin:/usr/local/bin:/usr/bin:/usr/local/bin:/usr/bin
Can anyone help me troubleshoot all of this? From what I understand: I only need Python2.x for OS; with Catalina I should now be storing Python3.x only within my User (not in /usr)? pip3 is automatically installed with Python3.x (although mine is returning an error) and also should be installed within my User and not in /usr? Also, my $PATH still contains remnants, e.g., Anaconda, which I have since removed... how/where do I update my $PATH? Within the zshrc file?
I've experienced this issue after a clean installation of Catalina. I'm also using zsh
.
What I did wrong:
I've installed a new version of pip
by using:
sudo pip3 install --upgrade pip
as prompted. However, this will not work with Apple's python
, as the path will not be correct. Instead, sudo -H
should be used.
How I fixed pip:
Fortunately, python3 -m pip
still works as a workaround for pip3
.
Install an older version of pip
(in my case, 19.3.0
was sufficient):
sudo -H python3 -m pip install --upgrade pip==19.3.0
and then upgrade again:
sudo -H python3 -m pip install --upgrade pip
I hope this will also solve your issue.