0

I am new in macOS, and I have a little problem with installing python. I have downloaded from python webpage current version 3.9, and installed it. Now if I open command line, and write command

python3 -V

get result

Python 3.8.2

If I run

sudo python3 -V

I get

Python 3.9.7

How can I change it, I would like to have same version even tough I run it without sudo.

jozinko9
  • 13
  • 5

3 Answers3

0

An easy way to keep everything consistent is to use something called a Virtual Environment. Here is a ref: https://sourabhbajaj.com/mac-setup/Python/virtualenv.html

A few tips:

  1. Create the venv under a folder that will work as the top folder of your new 'Workspace'.

  2. You will need to activate your venv with this command:

    source venv/bin/activate

I promise it is much easier than it sounds, and it works great.

Technoob1984
  • 172
  • 9
0

If python 3.8.2 still comes up wherever and you don't need it then that means it's obviously still in your system so locate the folder and application somewhere and just deleting it by moving to bin should do the trick, make sure you're deleting the right version of python, do not delete Version 2.7 because macOS needs it to run things

yungmaz13
  • 139
  • 11
0

Try pyenv

Managing multiple python version is not easy.

With pyenv, you can install a python version as simple as pyenv install 3.3.6. It's also quite easy to manage multiple python version and to switch version for different terminals.

Iceberg
  • 2,744
  • 19
  • 19