Skip to content

Instantly share code, notes, and snippets.

@romanegloo
Last active December 28, 2018 15:16
Show Gist options
  • Save romanegloo/7220586fe0c8fa40fde0aeee1fa73229 to your computer and use it in GitHub Desktop.
Save romanegloo/7220586fe0c8fa40fde0aeee1fa73229 to your computer and use it in GitHub Desktop.
Uninstall a Python version and reinstall a new oone

On Mac OS, managing Python versions with homebrew is not trivial, almost impossible.

Here, I uninstall pre-installed python version and re-install a new specific version.

To Uninstall a Python3 version

    ls -l /usr/local/bin | grep /Library/Frameworks/Python.framework/Versions/3 | awk '{print "rm \47/usr/local/bin/" $9 "\47"}'
    ls -d /Library/Frameworks/Python.framework/Versions/3.* 2> /dev/null | awk '{print "rm -rf \47" $0 "\47"}'
    ls -d /Applications/Python\ 3.* 2> /dev/null | awk '{print "rm -rf \47" $0 "\47"}'

Download a new version of Python3

  1. Download a version from here: https://www.python.org/downloads/
  2. Install (note that you include openssl library path)
    tar xzvf Python-[version].tgz  
    cd Python-[version]  
    ./configure --prefix=/usr/local --enable-shared CPPFLAGS="-I/usr/local/opt/openssl/include" LDFLAGS="-L/usr/local/opt/openssl/lib"
    make  
    sudo make install  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment