You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
How to remove python3.5 and activate python3.9 (both seem to be installed and collide...)?
How to remove python3.5 and activate python3.9 (both seem to be installed and collide...)?
Hi, I seem to have managed to get multiple installations of python in my Mac OS 10.14.6 folder hierarchy and would very much appreciate if someone could help me sort this out via brew/Terminal...
When I write "python --version" in Terminal I get back "Python 2.7.17"
When I write "python3 --version" I get back "Python 3.5.1"
When I write "python3.9 --version" I get back "Python 3.9.4"
When I write "which python" I get back "/usr/local/bin/python"
When I write "which python3" I get back "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3"
When I write "which python3.9" I get back "/usr/local/bin/python3.9"
When I write "brew upgrade python" I get back "python 3.9.4 already installed"
When I write "sudo pip install --upgrade python" I get back the following error message:
"DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
WARNING: The directory '/Users/mark/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag."
How do I completely remove python3.5 from my system and make sure that all necessary pointers are directed to the location where python3.9 now resides..?
Many thanks in advance for help in straightening this out! :-)
/Mark
Hi carlocab, thanks for your help!
When I type "echo $PATH" I get the following back:
"/Library/Frameworks/Python.framework/Versions/3.5/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
I guess this means that 3.5 is somehow still the "active version", even though I obviously also have 3.9.4 installed? If so, the question is how do I remove the old 3.5 and activate the 3.9 path instead?
Thanks,
You need to remove that first part from your
PATH
. Unfortunately, there are many ways it can be set. I'd start by looking in
~/.profile
,
~/.bash_profile
,
~/.zshrc
or
~/.zprofile
for lines adding it to your
PATH
.
You definitely did not install Python3.5 using Homebrew. It's likely from a Python.org installer; I'd look there for uninstallation instructions.
Thanks again! I'm afraid though that this advice is above my skill level; I was thinking/hoping that there would be a simple Terminal command (or two) that I could write in order to make python3.9 the active python version in my system, and also remove python3.5 (as it appears it is no longer supported) — but perhaps such a move is more complicated than that?
/Mark
export "$(brew --prefix)/bin:$PATH"
every time you start the terminal. When that gets inconvenient enough, you can add it to the bottom of one of ~/.profile, ~/.bash_profile, ~/.zshrc or ~/.zprofile, depending on which one your shell uses.
This doesn't uninstall Python3.5 -- it just makes sure calling python3 in your terminal just finds Homebrew Python first.
A proper fix is more complicated than that, but that's the best I can think of in terms of a simple Terminal command (or two).
Thank you so much for that very clever trick! However, given that I have python installed at "/usr/local/bin/python" and python3.9 installed at "/usr/local/bin/python3.9", can't I just somehow remove python3.5 from "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5" via Terminal and then use a symlink (or similar) command to direct youtube-dl (and svtplay-dl) to use python3.9 every time python3.x is required?
Do you have a /usr/local/bin/python3? That should probably be Homebrew Python3.
If you installed youtube-dl and svtplay-dl using Homebrew it should already be making use of Homebrew Python3 without needing to make any changes to your PATH.
can't I just somehow remove python3.5 from "/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5" via Terminal
Maybe, yea. I'd be wary of doing something like that as it could break something. The simpler solution really would be to figure out how /Library/Frameworks/Python.framework/Versions/3.5/bin is showing up first in your PATH and fixing that, as that would allow you to completely ignore your Python3.5 install.
Thanks for feedback, it sounds like we're on to something here! :-)
In my "/usr/local/bin/" folder I have the following alias files beginning with "py" (thus being python related I presume):
pycrust
pydoc
pydoc2
pydoc2.7
pydoc3
pydoc3.5
pydoc3.9
pyshell
pyslices
pyslicesshell
python
python-config
python2
python2-config
python2.7
python2.7-config
python3
python3-32
python3-config
python3.5
python3.5-32
python3.5-config
python3.5m
python3.5m-config
python3.9
python3.9-config
pythonw
pythonw2
pythonw2.7
pyvenv-3.5
pywxrc
Is this helpful in trying to figure out why my "echo $PATH" points to the python3.5 installation at "/Library/Frameworks/Python.framework/Versions/3.5/bin", or what can be done to change this to the python3.9 location instead?
/Mark
I'm afraid your answers, although you've been very kind to take the time to share these with me, are beyond my skill level and ability to practically implement. I had hoped for a couple of commands to type into Terminal that would sort everything out (i.e. remove python3.5 and activate python3.9). Thanks anyway for trying! :-)
This doesn't take any skill, to be honest. Just patience and research. Here's some things to read to get you started:
https://en.wikipedia.org/wiki/PATH_(variable)
https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them
https://astrobiomike.github.io/unix/modifying_your_path
https://superuser.com/questions/49289/what-is-the-bashrc-file
https://unix.stackexchange.com/questions/129143/what-is-the-purpose-of-bashrc-and-how-does-it-work
https://www.journaldev.com/41479/bashrc-file-in-linux
https://www.maketecheasier.com/what-is-bashrc/
These are just some of the things I get from Googling "what is PATH" or "what is bashrc", so you could probably do even better than that.