How to set up environment variables in Python
To configure the environment variable for Python, you can follow these steps:
- Open the “Control Panel” on the computer.
- Click on “System and Security”, and then click on “System”.
- Click on “Advanced System Settings”.
- Click on the “Environment Variables” button in the popped up “System Properties” window.
- In the list under “User Variables” or “System Variables”, locate the variable named “Path” and click on “Edit”.
- Click on “New” in the pop-up “Edit Environment Variables” window.
- Please input the installation path of the Python interpreter, which is usually “C:\PythonXX”, where XX is the version number of Python. For example, if you have installed Python 3.9, the path would be “C:\Python39”.
- Click “OK”, and then close all open windows one by one.
Once the above steps are completed, Python’s environment variables are set up. You can run the “python” command in the command prompt or terminal to verify if it was successful.