Milos Potic
Milos Potic

Reputation: 5

Can't find python in Environment variables path although it is added to path?

"python" command in cmd works just fine, which I believe means that python is added to path. I can't find it in PATH in Environment variables tho. The reason Im messing with this is because I want to remove python 3.10 from path to and to add python 3.9.

Upvotes: 0

Views: 2015

Answers (2)

Olasimbo
Olasimbo

Reputation: 1063

You can also use multiple python versions with pyenv

https://youtu.be/HTx18uyyHw8

Upvotes: 0

vht981230
vht981230

Reputation: 4936

PATH environment variable only store the paths to the directory to find commands or executable files. If you're on Linux or Mac OS, you can find where the python path is from using the command

which python

which will then reveal the path to the python executable like below example

/usr/bin/python

You can then see where the path is linked to which version of Python using the command ls -l <path to python executable>

> ls -l /usr/bin/python
lrwxr-xr-x  /usr/bin/python -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

If you want to link python command to a specific version of python executable, you can add this line to either .zshrc (zsh shell) or .bashrc (bash shell) depending on which shell your terminal is using

alias python='</path/to/python3/executable>'

Upvotes: 1

Related Questions