Home >Common Problem >2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD

2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD

王林
王林forward
2023-04-13 23:31:073269browse

Installing Python 3 on Windows 10 or 11

Here we discuss two ways to set up Python, one is using the graphical installation wizard and the other is with the help of prompt or Powershell (Terminal) command in .

Using the graphical user interface:

1. Download the latest version of Python

As we all know, by default, Python is not included in Windows to compile our based its program. So, visit the official website python.org and download the latest version by clicking the "Download" button.

2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD

2. Start the Python installation on Windows

After completing the previous steps, you will already have the python executable file on Windows.

  • Double-click the python executable file to start the installation wizard.
  • Select the "Add Python.exe to PATH" box, otherwise we won't be able to run PIP or Python using native Windows Powershell or Command Prompt.
  • Then click the "Install Now" option.
2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD
  • The installer will start running, which will also install PIP and documentation on your system.
2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD
  • Click the Close button to complete the installation.
2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD

#3. Check the version

To confirm that the installation was successful without any errors, let’s check the versions of Python and PIP installed. To do this, you can use Command Prompt or Powershell. or , we can also run Python Terminal application to issue commands as in your Windows search type - python appears as its application and then click to open it. You will also have a Python interpreter with version details.

 python --version

Check PIP version

pip -V

Note: If you type python on the command terminal or Powershell, open the Microsoft Store, and then follow the next step.

2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD

4. Prevent Python from opening the Microsoft Store

By default, if you type python in the command prompt or type PowerShell in Windows, it will Open the Microsoft Store to download another version of Python instead of using the existing one. To stop it and tell the system to run the one you installed, follow these steps:

  1. Go to Windows Search Box
  2. Type-Management Application execution alias
  3. When its icon appears, click to open it.
  4. SearchPython3 and PythonApplication Installer
  5. Closetoggle buttons provided for them there.
  6. Close your CMD terminal or Powershell and reopen it.
  7. Now type python in it to check your current version.
2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD

#Use command line mode

5. Open PowerShell, CMD or terminal (administrator)

Right-click the Windows Start button and select Terminal (Administrator). If you have PowerShell, you can do this too.

2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD

6. List Python versions

When you do a command line installation, there are multiple versions available for installation. We can use Winget to first check what they are before installing them.

winget 搜索 Python.Python
2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD

7.使用Winget安装Python

一旦您决定了哪个版本适合您的项目,然后使用以下语法进行设置。

winget install Python.Python.version-number

例如,如果你想要3.11那么命令将是这样的:

winget install Python.Python.3.11

完成后,关闭您的 CMD 终端或 PowerShell,然后再次重新打开它以检查它是否正常工作。

为此,要么使用:

pip -Vor  python --version

8.运行一个简单的程序

打开 Python 命令行并键入:

print ('Hey I am here with Python')

上面的代码将在您的屏幕上打印“嘿,我在这里使用 Python ”。

2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD

The above is the detailed content of 2 ways to install the latest Python on Windows 11 or 10 - GUI and CMD. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yundongfang.com. If there is any infringement, please contact admin@php.cn delete