How to change python version windows

I installed Python 2.6 and Python 3.1 on Windows 7 and set environment variable: path = d:\python2.6.

When I run python in cmd, it displays the python version 2.6, which is what I want!
But, when I wrote a script in a bat file and ran it, the displayed python version was 3.1.

import sys
print (sys.version)

What’s going on here?

Mark Tolonen's user avatar

Mark Tolonen

167k26 gold badges169 silver badges251 bronze badges

asked Feb 23, 2011 at 6:47

rooney's user avatar

2

This is if you have both the versions installed.

Go to This PCRight-clickClick on PropertiesAdvanced System Settings.

You will see the System Properties. From here navigate to the Advanced Tab -> Click on Environment Variables.

You will see a top half for the user variables and the bottom half for System variables.

Check the System Variables and double-click on the Path (to edit the Path).

Check for the path of Python(which you wish to run i.e. Python 2.x or 3.x) and move it to the top of the Path list.

Restart the Command Prompt, and now when you check the version of Python, it should correctly display the required version.

Neuron's user avatar

Neuron

5,1875 gold badges38 silver badges60 bronze badges

answered Oct 21, 2018 at 7:30

Aditya Deshpande's user avatar

Aditya DeshpandeAditya Deshpande

1,7561 gold badge10 silver badges12 bronze badges

6

The Python installer installs Python Launcher for Windows. This program (py.exe) is associated with the Python file extensions and looks for a «shebang» comment to specify the python version to run. This allows many versions of Python to co-exist and allows Python scripts to explicitly specify which version to use, if desired. If it is not specified, the default is to use the latest Python version for the current architecture (x86 or x64). This default can be customized through a py.ini file or PY_PYTHON environment variable. See the docs for more details.

Newer versions of Python update the launcher. The latest version has a py -0 option to list the installed Pythons and indicate the current default.

Here’s how to check if the launcher is registered correctly from the console:

C:\>assoc .py
.py=Python.File

C:\>ftype Python.File
Python.File="C:\Windows\py.exe" "%1" %*

Above, .py files are associated with the Python.File type. The command line for Python.File is the Python Launcher, which is installed in the Windows directory since it is always in the PATH.

For the association to work, run scripts from the command line with script.py, not «python script.py», otherwise python will be run instead of py. If fact it’s best to remove Python directories from the PATH, so «python» won’t run anything and enforce using py.

py.exe can also be run with switches to force a Python version:

py -3 script.py       # select latest Python 3.X version to be used.
py -3.6 script.py     # select version 3.6 specifically.
py -3.9-32 script.py  # select version 3.9 32-bit specifically.
py -0                 # list installed Python versions (latest PyLauncher).

Additionally, add .py;.pyw;.pyc;.pyo to the PATHEXT environment variable and then the command line can just be script with no extension.

answered Feb 23, 2011 at 8:31

Mark Tolonen's user avatar

Mark TolonenMark Tolonen

167k26 gold badges169 silver badges251 bronze badges

4

Running ‘py’ command will tell you what version you have running. If you currently running 3.x and you need to switch to 2.x, you will need to use switch ‘-2’

py -2

If you need to switch from python 2.x to python 3.x you will have to use ‘-3’ switch

py -3

If you would like to have Python 3.x as a default version, then you will need to create environment variable ‘PY_PYTHON’ and set it’s value to 3.

answered Jan 14, 2017 at 13:19

Vlad Bezden's user avatar

Vlad BezdenVlad Bezden

84.3k25 gold badges248 silver badges181 bronze badges

3

If you know about Environment variables and the system variable called path, consider that any version of any binary which comes sooner, will be used as default.

Look at the image below, I have 3 different python versions but python 3.8 will be used as default since it came sooner than the other two. (In case of mentioned image, sooner means higher!)

enter image description here

answered Jan 23, 2020 at 7:49

AmiNadimi's user avatar

AmiNadimiAmiNadimi

5,1893 gold badges39 silver badges55 bronze badges

0

If you are a Windows user and you have a version of Python 3.3 or greater, you should have the Python Launcher for Windows installed on your machine, which is the recommended way to use for launching all python scripts (regardless of python version the script requires).

As a user

  • Always type py instead of python when running a script from the command line.

  • Setup your «Open with…» explorer default program association with C:\Windows\py.exe

  • Set the command line file extension association to use the Python Launcher for Windows (this will make typing py optional). In an Admin cmd terminal, run:

    ftype Python.File="C:\Windows\py.exe" "%L" %*

    ftype Python.NoConFile="C:\Windows\pyw.exe" "%L" %*

  • Set your preferred default version by setting the PY_PYTHON environment variable (e.g. PY_PYTHON=3.11). You can see what version of python is your default by typing py. You can also set PY_PYTHON3 or PY_PYTHON2 to specify default python 3 and python 2 versions (if you have multiple).

  • If you need to run a specific version of python, you can use py -M.m (where M is the major version and m is the minor version). For example, py -3 will run any installed version of python 3.

  • List the installed versions of python with py -0.

As a script writer

  • Include a shebang line at the top of your script that indicates the major version number of python required. If the script is not compatible with any other minor version, include the minor version number as well. For example:

    #!/usr/bin/env python3

    Note: (see this question) If python3 does not work for you, ensure that you’ve installed python from the Windows Store (e.g. via winget install --id 9NRWMJP3717K, as the winget package Python.Python.3.11 does not appear to include a python3.exe).

  • You can use the shebang line to indicate a virtual environment as well (see PEP 486 below).


See also

  • PEP 397 — Python launcher for Windows
  • PEP 486 — Make the Python Launcher aware of virtual environments
  • Python Launcher for Windows — User Guide

answered Aug 2, 2019 at 23:02

Casey Kuball's user avatar

Casey KuballCasey Kuball

7,7175 gold badges39 silver badges70 bronze badges

1

See here for original post

;
; This is an example of how a Python Launcher .ini file is structured.
; If you want to use it, copy it to py.ini and make your changes there,
; after removing this header comment.
; This file will be removed on launcher uninstallation and overwritten
; when the launcher is installed or upgraded, so don't edit this file
; as your changes will be lost.
;
[defaults]
; Uncomment out the following line to have Python 3 be the default.
;python=3

[commands]
; Put in any customised commands you want here, in the format
; that's shown in the example line. You only need quotes around the
; executable if the path has spaces in it.
;
; You can then use e.g. #!myprog as your shebang line in scripts, and
; the launcher would invoke e.g.
;
; "c:\Program Files\MyCustom.exe" -a -b -c myscript.py
;
;myprog="c:\Program Files\MyCustom.exe" -a -b -c

Thus, on my system I made a py.ini file under c:\windows\ where py.exe exists, with the following contents:

[defaults]
python=3

Now when you Double-click on a .py file, it will be run by the new default version. Now I’m only using the Shebang #! python2 on my old scripts.

answered May 11, 2013 at 21:48

Ehsan Iran-Nejad's user avatar

Ehsan Iran-NejadEhsan Iran-Nejad

1,6971 gold badge15 silver badges20 bronze badges

0

  1. Edit registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\python.exe\default
  2. Set default program to open .py files to python.exe

Druid's user avatar

Druid

6,4334 gold badges41 silver badges56 bronze badges

answered Aug 2, 2012 at 3:14

cuble's user avatar

cublecuble

3062 silver badges7 bronze badges

This work for me.

If you want to use the python 3.6 you must move the python3.6 on the top of the list.

The same applies to the python2.7
If you want to have the 2.7 as default then make sure you move the python2.7 on the very top on the list.

step 1

enter image description here

step 2

enter image description here

step 3

enter image description here

then close any cmd command prompt and opened again, it should work as expected.

python —version

>>> Python 3.6

answered Dec 22, 2018 at 1:07

1

With Python versions 2.7, 3.7, 3.9, and 3.11 installed on my Windows 11 OS, I encountered issues with the previously suggested solutions. However, I found a straightforward method that worked for me.

First, let’s understand how to set the default Python version using the py command. Running py --help provides hints, including a reference to the py.ini file located in %LOCALAPPDATA%\py.ini. This file allows us to specify the default Python version.

To set a specific default Python version:

  1. Open a text editor or create a file in %LOCALAPPDATA%\py.ini.

  2. Add the following content to the py.ini file:

[defaults]
python=3.7
  1. Save the file.

Now, when you run py --version in the console, it should display the specified default Python version.

Please note the following additional points to consider:

  • Purpose of setting the default Python version: Setting a specific default Python version can be helpful for ensuring compatibility with certain dependencies or maintaining consistency across projects.

  • Location of %LOCALAPPDATA%: The %LOCALAPPDATA% environment variable typically refers to C:\Users\<username>\AppData\Local. If the py.ini file does not exist in that location, you can create it manually.

answered Aug 4, 2022 at 11:30

flydev's user avatar

flydevflydev

4,4372 gold badges32 silver badges36 bronze badges

2

This worked for me:

Go to

Control Panel\System and Security\System

select

Advanced system settings from the left panel
from Advanced tab click on Environment Variables

In the System variables section search for (create if doesn’t exist)

PYTHONPATH

and set

C:\Python27\;C:\Python27\Scripts;

or your desired version

You need to restart CMD.

In case it still doesn’t work you might want to leave in the PATH variable only your desired version.

answered Nov 14, 2017 at 0:24

George B's user avatar

George BGeorge B

4141 gold badge7 silver badges17 bronze badges

Now that Python 3.3 is released it is easiest to use the py.exe utility described here:
http://www.python.org/dev/peps/pep-0397/

It allows you to specify a Python version in your script file using a UNIX style directive. There are also command line and environment variable options for controlling which version of Python is run.

The easiest way to get this utility is to install Python 3.3 or later.

answered Jan 3, 2013 at 5:57

Gerald's user avatar

GeraldGerald

6095 silver badges13 bronze badges

If you are on Windows, use the ASSOC command to change the default python version for python programs.

assoc .py=<Python 3.1 directory>

answered Jul 23, 2021 at 8:08

DerpyCoder's user avatar

DerpyCoderDerpyCoder

1271 silver badge6 bronze badges

Nothing above worked, this is what worked for me:

ftype Python.File=C:\Path\to\python.exe "%1" %*

This command should be run in Command prompt launched as administrator

Warning: even if the path in this command is set to python35, if you have python36 installed it’s going to set the default to python36. To prevent this, you can temporarily change the folder name from Python36 to xxPython36, run the command and then remove the change to the Python 36 folder.


Edit: This is what I ended up doing: I use Python Launcher.
https://stackoverflow.com/a/68139696/3154274

answered Nov 30, 2016 at 6:30

MagTun's user avatar

MagTunMagTun

5,6595 gold badges63 silver badges104 bronze badges

2

Check which one the system is currently using:

python --version

Add the main folder location (e.g. C/ProgramFiles) and Scripts location (C/ProgramFiles/Scripts) to Environment Variables of the system. Add both 3.x version and 2.x version

Path location is ranked inside environment variable. If you want to use Python 2.x simply put path of python 2.x first, if you want for Python 3.x simply put 3.x first

This uses python 2

answered Apr 6, 2018 at 9:06

pranavhd's user avatar

I had same problem and solve it by executing the installation file again. when you do that python automatically knows you have installed it before so it recommends you 3 options! select modify and select all packages you want to modify then in the next page you can check if new version of python is added to your environment variables or not. check it and then execute modification. I did and it solved.

answered Oct 16, 2022 at 8:41

Amir Sadeqi's user avatar

3

Since my problem was slightly different and none of the above worked for me, I’ll add what worked for me. I had installed the new python launcher for python 3.10 today, installed the version through it, but the command window did not recognise the version. Instead, it listed older python3 versions I had on my computer.

Finally, in the windows programs list, I saw that I had two versions of the python launcher. I uninstalled the old one, and now python 3.10 shows up correctly when running py -0 and is the chosen version when running py.

Apologies if this is a noob answer, I am new to all this.

answered Aug 8, 2022 at 7:17

Draenth's user avatar

Set PY_PYTHON environment variable as 2.6 (or any version you want). Restart the terminal or cmd and type py -0p. The 2.6 should have a * next to it indicating that’s the default python version now.

answered May 18 at 1:06

vinodhraj's user avatar

vinodhrajvinodhraj

1771 silver badge7 bronze badges

Use SET command in Windows CMD to temporarily set the default python for the current session.

SET PATH=C:\Program Files\Python 3.5

answered Oct 22, 2016 at 14:31

ron4ex's user avatar

ron4exron4ex

1,08310 silver badges21 bronze badges

Try modifying the path in the windows registry (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment).

Caveat: Don’t break the registry :)

answered Feb 23, 2011 at 6:54

phooji's user avatar

phoojiphooji

10.1k2 gold badges38 silver badges45 bronze badges

2

Последнее обновление: 16.12.2022

На одной рабочей машине одновременно может быть установлено несколько версий Python. Это бывает полезно, когда идет работа с некоторыми внешними библиотеками, которые поддерживают разные версии python, либо в силу каких-то
других причин нам надо использовать несколько разных версий. Например, на момент написания статьи последней и актуальной является версия Python 3.11.
Но, допустим, необходимо также установить версию 3.10, как в этом случае управлять отдельными версиями Python?

Windows

На странице загрузок https://www.python.org/downloads/ мы можем найти ссылку на нужную версию:

Управление несколькими версиями Python

И также загрузить ее и установить:

Установка разных версий Python на Windows

Чтобы при использовании интерпретатора Python не прописывать к нему весь путь, добавим при установке его в переменные среды. Но здесь надо учитывать, что в переменных среды
может содержаться несколько путей к разным интерпретаторам Python:

Установка разных версий Python на Windows в переменные среды

Та версия Python, которая находится выше, будет версией по умолчанию. С помощью кнопки «Вверх» можно нужную нам версию переместить в начало, сделав версией по умолчанию.
Например, в моем случае это версия 3.11. Соответственно, если я введу в терминале команду

или

то консоль отобразит версию 3.11:

C:\python>python --version
Python 3.11.0

Для обращения к версии 3.10 (и всем другим версиям) необходимо использовать указывать номер версии:

C:\python>py -3.10 --version
Python 3.10.9

например, выполнение скрипта hello.py с помощью версии 3.10:

Подобным образом можно вызывать и другие версии Python.

MacOS

На MacOS можно установить разные версии, например, загрузив с официального сайта пакет установщика для определенной версии.

Для обращения к определенной версии Python на MacOS указываем явным образом подверсию в формате python3.[номер_подверсии]. Например, у меня установлена версия
Python 3.10. Проверим ее версию:

Аналогично обращении к версии python3.9 (при условии если она установлена)

К примеру выполнение скрипта hello.py с помощью версии python 3.10:

Linux

На Linux также можно установить одновременно несколько версий Python. Например, установка версий 3.10 и 3.11:

sudo apt-get install python3.10
sudo apt-get install python3.11

Одна из версий является версий по умолчанию. И для обращения к ней достаточно прописать python3, например, проверим версию по умолчанию:

Для обращения к другим версиям надо указывать подверсию:

python3.10 --version
python3.11 --version

Например, выполнение скрипта hello с помощью версии Python 3.10:

Но может сложиться ситуация, когда нам надо изменить версию по умолчанию. В этом случае применяется команда update-alternatives для связывания
определенной версии Python с командой python3. Например, мы хотим установить в качестве версии по умолчанию Python 3.11. В этом случае последовательно выполним следующие команды:

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2

Числа справа указывают на приоритет/состояние. Так, для версии 3.11 указан больший приоритет, поэтому при обращении к python3 будет использоваться именно версия 3.11 (в моем случае это Python 3.11.0rc1)

Управление версиями Python в linux

С помощью команды

sudo update-alternatives --config python3

можно изменить версию по умолчанию

Установка версии Python по умолчанию в linux

Python is a well-known programming language when it comes to solving Data Science related problems. It helps in easing down the work of Data Science with the help of its fast execution of codes because of its built Object-Oriented Programming but, there is a problem with this language as well.

Many Pythonists find it difficult to access the correct Python version because of too many Python versions present in their computer system. Due to this, they face problems in downloading the necessary packages in the correct Python version they want.

This leads to many problems in code executions as well as creates confusion for the computer to throw which version at what time.

Now, the question arises of how to resolve this issue and how to add the desired Python version say 3 as the default version on Windows 7/10/11.

The answer to this question is simple and given below. Just make sure that you have 2 or more 2 Python versions downloaded in the system to follow these steps of fixing the issue.

Steps to Change the Default Python Version on Windows 10/11 to Python 3

  • Open your command prompt and check the current Python version the system is using. This will help you get to know which version you are using right now and with which version you want to replace the same.
  • python --version

Check Default Python Version on Windows 10 using command prompt

  • After checking the Python version find the path of your Python versions that will be present most probably in C Drive under the Program Files folder.
  • Open the Program Files folder and locate your Python versions. After locating the same click on the versions and copy the path of the scripts folder of all the Python versions installed.

Find Installed Python folder
Select Pyhton 3 Scripts folder

  • Also, copy the path of the Program Files being present in C Drive.
  • Once the paths are copied the next step is to locate your Environment Variables for the computer. This can be done by right-clicking on the “This PC” option of your computer and clicking on the Properties option. After clicking on the same click on Advanced System Settings under the Properties option.
  • Once done, a pop will come on the screen displaying various options out of which you need to click on the Environment Variables option. The Environment Variables will open up for you and you can see all the system variables present there.

Environment Variables option to change the Windows 10 or 7 Python version

  • The Environment Variablsegregatedgintendednto two different parts that are User Variables and System Variables. Just locate the Path option under the System Variables and click on the same.
  • After clicking on the Path option make sure to put the Scripts and Program Files path of different Python versions that you currently want to use and work in, and where you want to store all your necessary packages should be put first followed by others. Simply, click on the Browse button and select the path of the Script folder and the Python3 itself.
  • Note: Remove any other Python Version available in the System variables, for example, Python2. Select its path and click on the Delete button.
  • Press the OK button to save the changes in the Windowgovernmentalentaltal Variables.

Add Python 3 directory path in Windows 10 or 7

  • Once this is done, restart your Command prompt and again type python --version. Now you will find the desired version there on the system and ready to be usable by the coder.

Conclusion

This is how a user can get his/her Python version when there are multiple versions on the computer. Try this out and start coding with your desired version.

Python is a popular, high-level programming language that is widely used for a variety of applications. When installing Python on a computer, the latest version is usually set as the default version. However, it’s possible to switch between different versions of Python installed on a computer if the need arises. This can be especially important when working with projects that require a specific version of Python or when multiple versions of Python are required for different tasks. Here are a few methods to change the default Python version on your computer:

Method 1: Using Update-Alternatives

To change the default Python version on your system using Update-Alternatives, follow these steps:

  1. Check the installed Python versions on your system using the following command:

  2. Identify the version of Python you want to set as the default. For example, let’s say you want to set Python 3.9 as the default version.

  3. Use the following command to add Python 3.9 to the list of alternatives:

    sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1

    In this command, /usr/bin/python is the symbolic link for the Python binary that is currently set as the default. /usr/bin/python3.9 is the path to the Python 3.9 binary. The 1 at the end is the priority level of the alternative.

  4. Set the newly added Python version as the default using the following command:

    sudo update-alternatives --set python /usr/bin/python3.9

    This command sets the priority of the alternative to the highest level.

  5. Verify that the default Python version has been changed using the following command:

    This command should output the version of Python that you set as the default.

That’s it! You have successfully changed the default Python version on your system using Update-Alternatives.

Method 2: Modifying Path Variables

To change the default Python version on your system, you can modify the Path variables. Here are the steps to do it:

  1. Find the path of the Python version you want to set as default.

    For example, if you want to set Python 3.9.1 as default, the path might be:

  2. Open the Start menu and search for «Environment Variables». Click on «Edit the system environment variables».

  3. Click on the «Environment Variables» button.

  4. Under «System Variables», find the «Path» variable and click «Edit».

  5. Click «New» and paste the path of the Python version you want to set as default.

  6. Move the new path to the top of the list to ensure it takes precedence over other versions.

  7. Click «OK» to close all windows.

Now, when you run python from the command line, it will use the version you set as default.

Here’s an example of what the modified Path variable might look like:

C:\Python39;C:\Program Files\Python38\Scripts\;C:\Program Files\Python38\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Microsoft VS Code\bin;C:\Users\username\AppData\Local\Microsoft\WindowsApps;C:\Users\username\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\username\AppData\Local\Programs\Python\Python39\;C:\Users\username\AppData\Roaming\npm

Note that the exact path may vary depending on your system and Python version.

I hope this helps you change the default Python version on your system.

Method 3: Using Virtual Environments

Using virtual environments is a great way to manage different versions of Python on your system. Here’s how you can change the default Python version using virtual environments:

Step 1: Install Virtualenv

First, you need to install virtualenv using pip. Open your terminal and run the following command:

Step 2: Create a Virtual Environment

Next, create a virtual environment using the Python version you want to use. For example, if you want to use Python 3.8, run the following command:

virtualenv -p python3.8 myenv

This will create a new virtual environment called «myenv» using Python 3.8.

Step 3: Activate the Virtual Environment

To activate the virtual environment, run the following command:

source myenv/bin/activate

This will activate the virtual environment and change your default Python version to the one you specified when creating the environment.

Step 4: Verify the Python Version

To verify that you are using the correct Python version, run the following command:

This should output the version of Python that you specified when creating the virtual environment.

Step 5: Deactivate the Virtual Environment

To deactivate the virtual environment and switch back to your system’s default Python version, run the following command:

This will deactivate the virtual environment and switch back to your system’s default Python version.

That’s it! Using virtual environments is a great way to manage different versions of Python on your system.

developing programmer development coding technologies

Python is known to be a Data Science programming language that effectively and simply solves algorithmic problems, or Python is used to develop web applications. Python is a universal programming language. Python eases the execution of code because of its built-in library functions in object-oriented programming.

Python has a large collection of library, and it keeps on upgrading. Due to this, there are many versions of Python and Pythonists sometimes find it difficult to make a particular Python version default. Through this write-up, let us understand how we can make the Python 3 version default in Windows operating system.

On this page

Step 1: Getting started from command-line

To check the Python version installed in your computer, you need to execute the following command command-line prompt:

py

You will be able to check the latest version of Python you have installed:

py -3

Step 2: Downloading relevant Python version

If in case, Python 3 is not installed in your system, try installing it from Python.org or follow this link https://www.python.org/downloads/windows/

Scroll down and download the executable file of the size of your windows (32-bit or 64-bit).

Download python for windows
Download python for windows

You only need to double click on the executable file and install it.

Step 3: Adding Python3 to the windows environment variable path

Now, when you have completed the installation of Python 3 in your system, let us see how we can add Python 3 version to the path. The default path will be:

C:\Users\This PC\AppData\Local\Programs\Python

Now, the above path is not convenient as AppData is a hidden folder that may cause problems with a few of the Python modules, such as Jupyter. Therefore, move it to a C drive (C:/)

Copy python modules in c-drive windows
Copy python modules in c-drive windows

Now, change the name of its executable to python3.exe.

Python3 .exe file
Python3 .exe file

Done? Now, Locate Environment Variables in your system. This will be done by right-clicking on “This PC” option in your computer and click on the Properties option. After doing this, click on Advanced System Settings under the Properties option.

Once you have done this, a pop-up will appear on the screen that will be displaying various options out of which you have to click on Environment Variable Option. The Environment Variables will open up and you can view all the system variables present there.

After clicking on the Path option, make sure to put the Scripts and Program Files path of different Python versions that you currently want to use and work in, and where you want to store all your necessary packages should be put first followed by others. Simply click on the Browse button and select the path of the Script folder and the Python3 itself.

Note: Remove any other Python Version available in the System variables, for example, Python2. Select its path and click on the Delete button.

Press the OK button to save the changes in the Windows’ Environmental Variables.Now, edit the environment variables to add new Python 3 to the path.

Python 3 environment variables - Windows
Python 3 environment variables – Windows
Windows environment variables
Windows environment variables
Python environment variables
Python environment variables

Add the two new variables as follows:

  • C:\Python38\
  • C:\Python38\Scripts

Now, click on OK button.

Python edit environment variables
Python edit environment variables

It’s time to open the command prompt:

Windows command prompt
Windows command prompt

When you type “python3” in the cmd, you should see the Python 3 interpreter opening:

Python3 in cmd
Python3 in command prompt.

Step 4: Upgrade pip to be able to install Python modules

If you are trying to run pip3 for this new python install, you could run into the following problem:

“Fatal error in launcher: Unable to create process”

Python fatal error in launcher
Python fatal error in launcher

Don’t worry! You can correct that by entering:

python3 -m install --upgrade pip

You pip will then will be upgraded and you will become able to install again Python modules.

Once this is done, restart your Command prompt and again type python,version. Now you will find the desired version there on the system and ready to be usable by the coder.

That’s all!

If you are facing any problem, leave a comment below.

Image source: Freepik Premium

Related Topics

  • PHP: Is it the best Programming Language ever?
  • How To Build A Great Search Box On Your Website
  • Latest Java Technologies & Trends for 2020
  • Facts about React Native you are still unaware of!
Profile picture for Sairam Uppugudla
Article by

CEO of CodeGnan
WittySparks Leadership Network Contributors

Entrepreneur, CEO, Data Scientist, or Data Enthusiast are the major features that describe Sairam Uppugudla the best. I am a tech expert with 7+ years of experience in multiple technologies like Data Science, Python, Data Analysis, Big Data, Machine Learning, NLP, etc. With 360 degrees of expertise in various technologies, I’ve been known for practical real-time projects. I love enjoying and exploring all about data. As an entrepreneur, my mission is to develop a culture of technology in the young and innovative minds who are our future.

  • How to check for updates in windows 10
  • How to change password to windows 10
  • How to delete efi partition from windows
  • How to check cpu temperature windows 10
  • How to change microsoft account on windows 10