How to add environment variable paths in Python?

To add Python to the PATH environment variable, you can follow these steps:

  1. Open the Control Panel: Click on the “Start” menu, then select “Control Panel”.
  2. Find and click on “System and Security” in the control panel.
  3. On the “System and Security” page, select “System”.
  4. Click on “Advanced system settings” on the left side of the “System” page.
  5. Click on the “Advanced” tab in the pop-up window of “System Properties.”
  6. Click on the “Environment Variables” button in the “Advanced” tab.
  7. In the “Environment Variables” window, locate the section for “System Variables,” then find the variable named “Path.”
  8. Select the “Path” variable and then click on the “Edit” button.
  9. Click on the “New” button in the “Edit Environment Variables” window.
  10. Enter the path to the Python installation directory, such as “C:\Python37”, and then click the “OK” button.
  11. Click the “OK” button in the “Environment Variables” window.
  12. 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.

bannerAds