如何在Windows 10上安装Python

Installing and using Python on Windows 10 is very simple. The installation procedure involves just three steps:

在Windows 10上安装和使用Python非常简单。 安装过程仅涉及三个步骤:

  1. Download the binaries

    下载二进制文件
  2. Run the Executable installer

    运行可执行安装程序
  3. Add Python to PATH environmental variables

    将Python添加到PATH环境变量

To install Python, you need to download the official Python executable installer. Next, you need to run this installer and complete the installation steps. Finally, you can configure the PATH variable to use python from the command line.

要安装Python,您需要下载官方的Python可执行安装程序。 接下来,您需要运行此安装程序并完成安装步骤。 最后,您可以从命令行将PATH变量配置为使用python。

You can choose the version of Python you wish to install. It is recommended to install the latest version of Python, which is 3.7.3 at the time of writing this article.

您可以选择要安装的Python版本。 建议安装最新版本的Python,在撰写本文时为3.7.3。

步骤1:下载Python Installer二进制文件 (Step 1: Download the Python Installer binaries)

  1. Open the official Python website in your web browser. Navigate to the Downloads tab for Windows.

    在网络浏览器中打开Python官方网站 。 导航到Windows的“下载”选项卡。
  2. Choose the latest Python 3 release. In our example, we choose the latest Python 3.7.3 version.

    选择最新的Python 3版本。 在我们的示例中,我们选择了最新的Python 3.7.3版本。
  3. Click on the link to download Windows x86 executable installer if you are using a 32-bit installer. In case your Windows installation is a 64-bit system, then download Windows x86-64 executable installer.

    如果您使用的是32位安装程序 ,请单击链接以下载Windows x86可执行安装程序。 如果您的Windows安装是64位系统,请下载Windows x86-64可执行安装程序

步骤2:运行可执行安装程序 (Step 2: Run the Executable Installer)

  1. Once the installer is downloaded, run the Python installer.

    下载安装程序后,请运行Python安装程序。
  2. Check the Install launcher for all users check box. Further, you may check the Add Python 3.7 to path check box to include the interpreter in the execution path.

    选中为所有用户安装启动程序复选框。 此外,您可以选中将Python 3.7添加到路径复选框以在执行路径中包括解释器。
  3. Select Customize installation.

    选择“ 定制安装”
  4. Choose the optional features by checking the following check boxes:

    通过选中以下复选框来选择可选功能:

    1. Documentation

      文献资料
    2. pip

      点子
    3. tcl/tk and IDLE (to install tkinter and IDLE)

      tcl / tk和IDLE(安装tkinter和IDLE)
    4. Python test suite (to install the standard library test suite of Python)

      Python测试套件(用于安装Python的标准库测试套件)
    5. Install the global launcher for `.py` files. This makes it easier to start Python

      为.py文件安装全局启动器。 这使得启动Python更容易
    6. Install for all users.

      为所有用户安装。

    Click Next.

    单击下一步

  5. This takes you to Advanced Options available while installing Python. Here, select the Install for all users and Add Python to environment variables check boxes.

    Optionally, you can select the Associate files with Python, Create shortcuts for installed applications and other advanced options. Make note of the python installation directory displayed in this step. You would need it for the next step.

    After selecting the Advanced options, click Install to start installation.

    高级选项” 。 在这里,选中“ 为所有用户安装”和“ 将Python添加到环境变量”复选框。

    (可选)您可以选择“将文件与Python关联” ,“ 为已安装的应用程序创建快捷方式”和其他高级选项。 记下此步骤中显示的python安装目录。 下一步将需要它。

    选择“高级”选项后,单击“ 安装”以开始安装。

  6. Once the installation is over, you will see a Python Setup Successful window.

    安装结束后,您将看到“ Python安装成功”窗口。

步骤3:将Python添加到环境变量 (Step 3: Add Python to environmental variables)

The last (optional) step in the installation process is to add Python Path to the System Environment variables. This step is done to access Python through the command line. In case you have added Python to environment variables while setting the Advanced options during the installation procedure, you can avoid this step. Else, this step is done manually as follows.

安装过程的最后(可选)步骤是将Python路径添加到系统环境变量。 完成此步骤以通过命令行访问Python。 如果在安装过程中设置“高级”选项时已将Python添加到环境变量中,则可以避免此步骤。 否则,此步骤如下所述手动完成。

In the Start menu, search for “advanced system settings”. Select “View advanced system settings”. In the “System Properties” window, click on the “Advanced” tab and then click on the “Environment Variables” button.

在开始菜单中,搜索“高级系统设置”。 选择“查看高级系统设置”。 在“系统属性”窗口中,单击“高级”选项卡,然后单击“环境变量”按钮。

Locate the Python installation directory on your system. If you followed the steps exactly as above, python will be installed in below locations:

在系统上找到Python安装目录。 如果您完全按照上述步骤进行操作,则会在以下位置安装python:

  • C:\Program Files (x86)\Python37-32: for 32-bit installation

    C:\ Program Files(x86)\ Python37-32:用于32位安装
  • C:\Program Files\Python37-32: for 64-bit installation

    C:\ Program Files \ Python37-32:用于64位安装

The folder name may be different from “Python37-32” if you installed a different version. Look for a folder whose name starts with Python.

如果安装了其他版本,则文件夹名称可能与“ Python37-32”不同。 查找名称以Python开头的文件夹。

Append the following entries to PATH variable as shown below:

将以下条目添加到PATH变量中,如下所示:

步骤4:验证Python安装 (Step 4: Verify the Python Installation)

You have now successfully installed Python 3.7.3 on Windows 10. You can verify if the Python installation is successful either through the command line or through the IDLE app that gets installed along with the installation.

现在,您已经在Windows 10上成功安装了Python 3.7.3。您可以通过命令行或通过随安装一起安装的IDLE应用程序来验证Python安装是否成功。

Search for the command prompt and type “python”. You can see that Python 3.7.3 is successfully installed.

搜索命令提示符,然后键入“ python”。 您可以看到Python 3.7.3已成功安装。

An alternate way to reach python is to search for “Python” in the start menu and clicking on IDLE (Python 3.7 64-bit). You can start coding in Python using the Integrated Development Environment(IDLE).

到达python的另一种方法是在开始菜单中搜索“ Python”,然后单击IDLE(Python 3.7 64位)。 您可以使用集成开发环境(IDLE)开始使用Python进行编码。

Hurray! You are ready to start developing Python applications in your Windows 10 system.

欢呼! 您已准备好开始在Windows 10系统中开发Python应用程序。

翻译自: https://www.journaldev.com/30076/install-python-windows-10

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值