0

"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.

3
  • check this out: stackoverflow.com/questions/7743281/… Commented May 22, 2022 at 14:11
  • Doesn't really help. The problem is that I have python in path, but it is not shown, so I can't remove it and instead put there the folder for python 3.9 to be used. Commented May 22, 2022 at 14:23
  • 1
    use where python to know the path of python first. Then follow this to remove python stackoverflow.com/a/60318668/1836069 Commented May 22, 2022 at 14:25

2 Answers 2

1

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>'
Sign up to request clarification or add additional context in comments.

1 Comment

I'm using Windows. And I have found the Environment variable, it was just well hidden under some AppData folders. Thank you for you help
0

You can also use multiple python versions with pyenv

https://youtu.be/HTx18uyyHw8

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.