How to add environment variable paths in Python?
To add Python to the PATH environment variable, you can follow these steps:
- Open the Control Panel: Click on the “Start” menu, then select “Control Panel”.
- Find and click on “System and Security” in the control panel.
- On the “System and Security” page, select “System”.
- Click on “Advanced system settings” on the left side of the “System” page.
- Click on the “Advanced” tab in the pop-up window of “System Properties.”
- Click on the “Environment Variables” button in the “Advanced” tab.
- In the “Environment Variables” window, locate the section for “System Variables,” then find the variable named “Path.”
- Select the “Path” variable and then click on the “Edit” button.
- Click on the “New” button in the “Edit Environment Variables” window.
- Enter the path to the Python installation directory, such as “C:\Python37”, and then click the “OK” button.
- Click the “OK” button in the “Environment Variables” window.
- Open a new command prompt window and type “python” to see if the Python interpreter launches successfully, which indicates that the environment variable configuration is successful.
Please note: The above steps are applicable to Windows systems, please make corresponding adjustments according to your own operating system.