0

Being a "normal" user (i.e. not overly familiar with code), I find myself in a bit of a python conundrum and would very much like to try to muster some kind of assistance with the following:

I use svtplay-dl and youtube-dl via homebrew in Mac OSX 10.14.6, which also requires python (among many other extensions such as ffmpeg et al). However, I now seem to have three different python versions installed, and since python3.5 is no longer supported, I thought I would delete this and make sure that homebrew/svtplay-dl/youtube-dl uses a path to python3.9.

When I type "which" followed by the following in Terminal:

python
python3.5
python3.9

...I get the following respective results:

/usr/local/bin/python
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
/usr/local/bin/python3.9

Based upon this short background info, can someone advise how I best uninstall/remove python3.5 and get homebrew et al to use python3.9 every time python is required?

Any help with this would be very much appreciated!

/Mark

Mark
  • 1
  • Hey Mark, do you use Anacona? If you do not you should consider it and you can just create different environments [envs](https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment) that run different versions of python. That would look like: `conda create -n python=3.5` then you can run whatever you want in that version of python. – brobertsp Apr 18 '21 at 11:21
  • Does this answer your question? [Use different Python version with virtualenv](https://stackoverflow.com/questions/1534210/use-different-python-version-with-virtualenv) – Aaron Apr 18 '21 at 11:32
  • Please, remove salutations. [Should 'Hi', 'thanks', taglines, and salutations be removed from posts?](https://meta.stackexchange.com/questions/2950/should-hi-thanks-taglines-and-salutations-be-removed-from-posts). Also we see your nick. Just try to make questions and answers as compressed as possible. Don't waste space. – maciejwww Apr 18 '21 at 17:42
  • Thanks for the Anaconda tip! I'm afraid this seems to be a bit above my skill level, but I will look into it :-). – Mark Apr 19 '21 at 23:22

1 Answers1

0

The normal answer is to use something like virtualenv (https://virtualenv.pypa.io/en/latest/) to isolate your python environment and dependencies locally.

You need to install virtualenv on your system, then you tell it what python version to install. Once activated, any dependencies are installed and isolated in that environment. Also see: https://gist.github.com/pandafulmanda/730a9355e088a9970b18275cb9eadef3

If you want to go a step further you can use docker (https://docs.docker.com/language/python/build-images/) to isolate everything, including the operating system, in that case you don't need virtualenv, but to start with I'd play around with virtualenv.

Aaron
  • 3,249
  • 4
  • 35
  • 51