1

I have followed the instructions at https://opensource.com/article/19/5/python-3-default-mac: Now, python -V shows 3.8.1, but pip -V still shows 19.2.3.

I checked with which pip3, which shows /Library/Frameworks/Python.framework/Versions/3.8/bin/pip3, but using

echo "alias pip=/Library/Frameworks/Python.framework/Versions/3.8/bin/pip3>> ~/.zshrc does not seem to work.

pip -V gives: pip 19.2.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pip (python 3.8).

I have MacOS Cataline 10.15.3. Can someone help please?

Machavity
  • 30,841
  • 27
  • 92
  • 100
Ryan
  • 19
  • 2

2 Answers2

2

There seems nothing wrong with your setup. pip has a version number that is independent of that of python. Your python version is 3.8 and the corresponding pip (which resides in python3.8/site-packages/pip) has version 19.2.3. You have set up everything just fine

FlyingTeller
  • 17,638
  • 3
  • 38
  • 53
-1

In fact I was trying to install python in pyenv and get my IDLE to work. The following worked for me (mostly from https://github.com/pyenv/pyenv/issues/1375; Installed Python 3 on Mac OS X but its still Python 2.7; https://opensource.com/article/19/5/python-3-default-mac, with a few additional steps). Thanks for your help. I posted my solution at https://github.com/pyenv/pyenv/issues/1375, too, for reference)

  1. ran $brew install pyenv
  2. ran $brew install tcl-tk

Output after "brew reinstall tcl-tk':

tcl-tk is keg-only, which means it was not symlinked into /usr/local, because tk installs some X11 headers and macOS provides an (older) Tcl/Tk.

If you need to have tcl-tk first in your PATH run:

echo 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' >> ~/.zshrc

(I added it to ~/.zshrc as the first line)

For compilers to find tcl-tk you may need to set:

export LDFLAGS="-L/usr/local/opt/tcl-tk/lib"

export CPPFLAGS="-I/usr/local/opt/tcl-tk/include"

(I added these two to ~/.zshrc, too, after adding the above)

For pkg-config to find tcl-tk you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig"

(I added this two to ~/.zshrc, too, after adding the above)

  1. To get tcl-tk 8.6 to work with the pyenv install of python, I found:

/usr/local/Cellar/pyenv/1.2.13/plugins/python-build/bin/python-build

and replaced the following: $CONFIGURE_OPTS ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" || return 1 with: $CONFIGURE_OPTS --with-tcltk-includes='-I/usr/local/opt/tcl-tk/include' --with-tcltk-libs='-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6' ${!PACKAGE_CONFIGURE_OPTS} "${!PACKAGE_CONFIGURE_OPTS_ARRAY}" || return 1

  1. ran $pyenv install 3.8.1 Installed Python-3.8.1 to /Users/ryan/.pyenv/versions/3.8.1

  2. ran $pyenv global 3.8.1

Refreshed the current terminal and checked

  1. $pyenv version output: 3.8.1 (set by /Users/ryan/.pyenv/version)

Ran $python -V output: Python 3.8.1

  1. ran $pip install --upgrade pip (since I had previously already installed pip using $pip install)

output: Successfully installed pip-20.0.2

  1. Tested my tcl-tk installation with $python -m tkinter -c 'tkinter._test()' Output: Tk window popped up. Hit ‘Quit’ to back to Terminal.

  2. Ran $ idle Output: Python 3.8.1 Shell window popped up.

The installation was done on a MacBook Pro with macOS Catalina 10.15.3.

Ryan
  • 19
  • 2