0

I've installed Python 3.7, and since installed python 3.8.

I've added both their folders and script folders to PATH, and made sure 3.8 is first as I'd like that to be default.

I see that the Python scripts folder has pip, pip3 and pip3.8 and the python 3.7 folder has the same (but with pip3.7 of course), so in cmd typing pip or pip3 will default to version 3.8 as I have that first in PATH.

This is great, as I can explicitly decide which pip version to run. However I don't know how to do to the same for Python. ie. run Python3.7 from cmd.

And things like Jupyter Notebooks only see a "Python 3" kernel and don't have an option for both.

How can I configure the PATH variables so I can specify which version of python3 to run?

2
  • 1
    This might be what you're looking for. Commented Feb 4, 2020 at 16:31
  • I would recommend using virtual environments, or something similar. Personally, I like Conda. Commented Feb 4, 2020 at 23:17

2 Answers 2

1

What OS are you running? If you are running linux and used the system package panager to install python 3.8 you should be able to invoke python 3.8 by typing python3.8. Having multiple binaries named python3 in your PATH is problematic, and having python3 in your PATH point to python 3.8 instead of the system version (which is likely a lower version for your OS) will break your system's package manager. It is advisable to keep python3 in your PATH pointing to whatever the system defaults to, and use python3.8 to invoke python 3.8.

The python version that Jupyter sees will be the version from which you installed it. If you want to be able to use Jupyter with multiple python versions, create a virtual environment with your desired python version and install Jupyter in that environment. Once you activate that specific virtual env you will be sure that the jupyter command that you invoke will activate the currect python runtime.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I have manually created virtual environments for projects before but as this was literally just to be able to visualise a pandas DataFrame object to look at some data, I didn't want to create a virtualenv just for that, but seems it's the only way.
1

I recommend you use pyenv a great tool for manage multiple python versions on the same system. Once installed you need to create a virtualenv, then activate the virtualenviroment and there you can install any libraries you want in a safe way.

By the way also come with an automatic installer pyenv-installer

Regards

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.