Installing python and setting environment variables under windows system

Python is widely used in this AI wave, so let’s set up a Python operating environment.
Now I have installed Python 1.10 version. I am not using the latest version because some Python libraries do not support higher versions.

Windows system

Go to the Python official website and directly download the installation program
Python Releases for Windows | Python.org
 


The installation process is just the next step and it will be successful. Remember to check and add to the environment variables.
 

environment variables

If we install the python program manually, we can also set the python environment variables in Windows ourselves.

Setting Python's environment variables on Windows allows you to run Python and pip commands globally from the command prompt (or PowerShell). Here are the steps on how to configure Python’s environment variables:

  1. Install Python :

    • When you download and install Python from its official website, the installer provides an option "Add Python to PATH". Make sure this option is checked to add Python to environment variables.

      If you already have Python installed and forgot to select this option, don't worry. You can manually add Python to the environment variables.

  2. Manually configure environment variables :

    • Open Control Panel > System > Advanced System Settings > Environment Variables.

    • In the System Variables section, find the variable named Path and select Edit.

    • In the Edit Environment Variables window, click "New" and add the Python installation path and Scripts subdirectory to the list. For example, if you installed Python in C:\Python39(depending on your Python version), you would need to add the following two paths:

      makefileCopy code
      C:\Python39\
      C:\Python39\Scripts\
      
      • The first path is the path to the Python interpreter.
      • The second path is the path to pip and some other scripts.
    • Click OK to save changes.

  3. Verify settings :

    • Open a new command prompt or PowerShell window.
    • Enter  python --version it and press Enter. This should show the Python version you have installed.
    • Enter  pip --version it and press Enter. This should show your pip version and the associated Python version.

Through the above steps, you should have successfully configured Python environment variables on Windows. Now, you can use python and pip commands from any command line or script.

Add my WeChat to communicate and discuss together

Guess you like

Origin blog.csdn.net/taoshihan/article/details/132928233