Skip to content

Instantly share code, notes, and snippets.

@basperheim
Last active August 22, 2021 12:42
Show Gist options
  • Save basperheim/bf5e239e9e31f33e174e1d44a11fac93 to your computer and use it in GitHub Desktop.
Save basperheim/bf5e239e9e31f33e174e1d44a11fac93 to your computer and use it in GitHub Desktop.
Install Python 3.8 and upgrade PIP on Windows

Install and setup Python 3 in Windows 10

Download and install Python using the interactive EXE installer and make sure to include the path. Make sure to check the py launcher and pip checkboxes as well.

Screenshot of the Windows 10 interactive install for Python 3

Once it's finished installing open a new command prompt window and verify Python 3 installed properly with the following command:

py -V

It should return something like: Python 3.8.x.

Set the paths for Python 3 and pip3

setx PATH "%PATH%;C:\Python38"
setx PATH "%PATH%;C:\Python38\Scripts"

Upgrade PIP3 using the py command

py -m  pip install --upgrade pip

If you get a permissions error then use the --user flag while installing:

py -m pip install --upgrade pip --user

The python3 and pip3 wrappers for the respective Python3 and PIP3 commands are now deprecated in Windows 10—use py and py -m pip instead.

Use the py command to enter into the interactive interpreter for Python 3 (Press CTRL+Z and then Return to exit the interface).

Use the following command to get your current version of PIP:

py -m pip -V

It should return something like: pip 20.0.2 from C:\Path\To\AppData\Roaming\Python\Python38\site-packages\pip (python 3.8)

Screenshot of py command for Python 3 and PIP3 in Windows 10 command prompt

Installing PIP packages for Python in Windows

The following example command will install PyGame using PIP3 for Python 3.8 in Window 10

py -m pip install pygame --user

To execute a Python script just use py followed by the script's path and file name:

py hello_world.py

Create a Python virtual environment on Windows 10

You'll have to use py -m with the Python venv command as well. The following example command will create a new virtual environemnt for you call new-venv:

py -m venv new-venv

Once it's finished you can input dir, and you should see the new-venv directory. Enter into the directory with the following:

cd new-venv

Now go inside the Scripts directory and execute the activate.bat file to enter inside the virtual environment:

activate.bat

Screenshot of a virtual environment for Python 3 in a Windows 10 command prompt

If you input exit it will stop the venv interface, but it will also close the command prompt window as well. Use the deactivate command to exit the venv without closing the command terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment