mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-25 23:11:02 +08:00
commit
11645f4fd9
@ -1,147 +0,0 @@
|
||||
[#]: subject: "How to Install Python on Windows [Beginner’s Guide]"
|
||||
[#]: via: "https://www.debugpoint.com/install-python-windows/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Install Python on Windows [Beginner’s Guide]
|
||||
======
|
||||
|
||||
**This simple guide demonstrates how to download and install Python on Windows.**
|
||||
|
||||
This article is tested with the latest Python 3.11 stable version.
|
||||
|
||||
Before you learn how to install Python on Windows, you might want to check how you can [install it easily][1] on Linux distributions such as Ubuntu. It’s better to try Python in Linux if you are planning to be a developer. That being said, you might want to check [how to install Linux (such as Ubuntu) alongside Windows][2].
|
||||
|
||||
Python is a popular general-purpose programming language which becomes the developer’s choice in the past decade. And its popularity is increasing every day. it is widely used for web development, complex systems, data science, machine learning and all areas of science.
|
||||
|
||||
There are two versions of Python that you may come across. Python2 is currently out of support. And the Python3 series is the ongoing support release.
|
||||
|
||||
### Check whether Python is installed
|
||||
|
||||
Before you install it on Windows, you should check whether it is already installed. In general, it should not be installed, unlike in Ubuntu (and other Linux distributions), where Python comes pre-installed.
|
||||
|
||||
From the start menu, open “command prompt”.
|
||||
|
||||
And type the following:
|
||||
|
||||
```
|
||||
python --version
|
||||
```
|
||||
|
||||
If Python is available, it will show you a message with the version details.
|
||||
|
||||
### Download and Install Python
|
||||
|
||||
Open the below official Python download page.
|
||||
|
||||
[Download Python][3]
|
||||
|
||||
![How to locate Python set up][4]
|
||||
|
||||
At the top, you should see the current stable version. Click on the download link. If you are looking for any specific version, scroll down on this page and download the specific version under the label “Python releases by version number:”.
|
||||
|
||||
After downloading, go to the Downloads folder and run the setup.
|
||||
|
||||
Follow the on-screen instructions to install it.
|
||||
|
||||
![Install Python step 1][5]
|
||||
|
||||
![Install Python step 2][6]
|
||||
|
||||
After installation is complete, verify the Python version.
|
||||
|
||||
### Verify Python Version
|
||||
|
||||
From the start menu, open “command prompt” and run the following command.
|
||||
|
||||
```
|
||||
python --version
|
||||
```
|
||||
|
||||
![Python version on Windows][7]
|
||||
|
||||
You should see your system’s currently installed version of the Python package. Alternatively, you can also run below to get a Python interactive shell.
|
||||
|
||||
```
|
||||
python
|
||||
```
|
||||
|
||||
You can exit the shell using CTRL+Z and Enter.
|
||||
|
||||
### Check PATH Variables
|
||||
|
||||
You should check the system variable PATH with the Python executable location. This should be updated automatically using the installer.
|
||||
|
||||
From the start menu, search “system variables” and open it.
|
||||
|
||||
![Open Environment variable Settings][8]
|
||||
|
||||
In the System Properties Dialog, click on `Advanced > Environment Variables`. Under the user variables section against the Path variable, check whether the Python installed location is present. Refer to the below image for a guideline.
|
||||
|
||||
If you see all the path is present, you are all set to run your Python project.
|
||||
|
||||
![Check Python Environment PATH Values in Windows][9]
|
||||
|
||||
### Create and run your first Python program
|
||||
|
||||
For an additional step, here’s how you can code & run your first Python program. You should ideally use any [recommended Python editor][10] to write your program.
|
||||
|
||||
Here’s a simple program which outputs the text “debugpoint.com” in the console.
|
||||
|
||||
```
|
||||
# Sample Python program
|
||||
print("debugpoint.com")
|
||||
```
|
||||
|
||||
Save the file with any name. Here I have saved it as “hello.py” in E drive. The .py is the extension of Python source codes.
|
||||
|
||||
To run this program, open a command prompt and execute below inside E drive.
|
||||
|
||||
```
|
||||
python hello.py
|
||||
```
|
||||
|
||||
**Output:**
|
||||
|
||||
![Running a simple Python program in Windows][11]
|
||||
|
||||
### Closing Notes
|
||||
|
||||
I hope this simple beginner’s guide helps you to install Python in Windows, verify the installation and run your first program.
|
||||
|
||||
Please let me know if you run into issues in the comment box below.
|
||||
|
||||
[Next:Share Folder Between Guest and Host in virt-manager (KVM/Qemu/libvirt)][12]
|
||||
|
||||
[_Using Mastodon? Follow us at floss.social/@debugpoint_][13]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/install-python-windows/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/install-python-3-11-ubuntu/
|
||||
[2]: https://www.debugpoint.com/complete-guide-how-dual-boot-ubuntu-windows/
|
||||
[3]: https://www.python.org/downloads/
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2023/01/How-to-locate-Python-set-up.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/Install-Python-step-1.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2023/01/Install-Python-step-2.jpg
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2023/01/Python-version-on-Windows.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2023/01/Open-Environment-variable-Settings.jpg
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2023/01/Check-Python-Environment-PATH-Values-in-Windows.jpg
|
||||
[10]: https://www.debugpoint.com/5-best-python-ide-code-editor/
|
||||
[11]: https://www.debugpoint.com/wp-content/uploads/2023/01/Running-a-simple-Python-program-in-Windows.jpg
|
||||
[12]: https://www.debugpoint.com/share-folder-virt-manager/
|
||||
[13]: https://floss.social/@debugpoint
|
@ -0,0 +1,141 @@
|
||||
[#]: subject: "How to Install Python on Windows [Beginner’s Guide]"
|
||||
[#]: via: "https://www.debugpoint.com/install-python-windows/"
|
||||
[#]: author: "Arindam https://www.debugpoint.com/author/admin1/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
如何在 Windows 上安装 Python(初学者指南)
|
||||
======
|
||||
|
||||
**这个简单的指南演示了如何在 Windows 上下载和安装 Python。**
|
||||
|
||||
这篇文章是用最新的 Python 3.11 稳定版测试的。
|
||||
|
||||
在学习如何在 Windows 上安装 Python 之前,你可能想看看如何在 Linux 发行版(如 Ubuntu)上[轻松安装][1] 。如果你打算成为一名开发者,最好在 Linux 中尝试 Python。既然如此,你可能想看看[如何在 Windows 之外安装 Linux(如 Ubuntu)][2]。
|
||||
|
||||
Python 是一种流行的通用编程语言,在过去十年中成为开发者的选择。而且它的受欢迎程度与日俱增。它被广泛用于网络开发、复杂系统、数据科学、机器学习和所有科学领域。
|
||||
|
||||
你可能遇到的 Python 有两个版本。Python2 目前已经不支持了。而 Python3 系列是持续支持的版本。
|
||||
|
||||
### 检查 Python 是否已经安装
|
||||
|
||||
在 Windows 上安装它之前,你应该检查它是否已经安装。一般来说,它应该没有安装,不像在 Ubuntu (和其他 Linux 发行版)中,Python 是预先安装的。
|
||||
|
||||
从开始菜单中,打开“命令提示符”。
|
||||
|
||||
并输入以下内容:
|
||||
|
||||
```
|
||||
python --version
|
||||
```
|
||||
|
||||
如果 Python 是可用的,它将显示一个包含版本细节的信息。
|
||||
|
||||
### 下载并安装 Python
|
||||
|
||||
打开下面的 Python 官方下载页面。
|
||||
|
||||
[下载 Python][3]
|
||||
|
||||
![如何定位 Python 安装][4]
|
||||
|
||||
在顶部,你应该看到当前的稳定版本。点击下载链接。如果你正在寻找任何特定的版本,在这个页面上向下滚动,在 “Python releases by version number:” 的标签下下载特定的版本。
|
||||
|
||||
下载后,进入下载文件夹,运行安装程序。
|
||||
|
||||
按照屏幕上的指示进行安装。
|
||||
|
||||
![安装 Python 第 1 步][5]
|
||||
|
||||
![安装 Python 第 2 步][6]
|
||||
|
||||
安装完成后,验证 Python 的版本。
|
||||
|
||||
### 验证 Python 版本
|
||||
|
||||
从开始菜单,打开“命令提示符”,运行以下命令。
|
||||
|
||||
```
|
||||
python --version
|
||||
```
|
||||
|
||||
![Windows 上的 Python 版本][7]
|
||||
|
||||
你应该看到你的系统当前安装的 Python 包的版本。另外,你也可以运行下面的程序来获得一个 Python 交互式 shell。
|
||||
|
||||
```
|
||||
python
|
||||
```
|
||||
|
||||
你可以用 CTRL+Z 和回车键退出这个 shell。
|
||||
|
||||
### 检查 PATH 变量
|
||||
|
||||
你应该用 Python 的可执行位置检查系统变量 PATH。这应该是使用安装程序自动更新的。
|
||||
|
||||
从开始菜单中,搜索“系统变量”并打开它。
|
||||
|
||||
![打开环境变量设置][8]
|
||||
|
||||
在“系统属性”对话框中,点击“高级>环境变量”。在用户变量部分,对照路径变量,检查 Python 的安装位置是否存在。请参考下面的图片作为指导。
|
||||
|
||||
如果你看到所有的路径都存在,你就可以运行你的 Python 项目了。
|
||||
|
||||
![检查 Windows 中的 Python 环境 PATH 值][9]
|
||||
|
||||
### 创建并运行你的第一个 Python 程序
|
||||
|
||||
一个额外的步骤,这里是你如何编码和运行你的第一个 Python 程序。你可以使用任意[推荐的 Python 编辑器][10]来编写你的程序。
|
||||
|
||||
下面是一个简单的程序,它在控制台中输出文本“debugpoint.com”。
|
||||
|
||||
```
|
||||
# Sample Python program
|
||||
print("debugpoint.com")
|
||||
```
|
||||
|
||||
用任意名字保存文件。这里我把它保存为 “hello.py”,放在 E 盘。.py 是 Python 源码的扩展名。
|
||||
|
||||
要运行这个程序,请打开命令提示符,在 E 盘中执行以下内容。
|
||||
|
||||
```
|
||||
python hello.py
|
||||
```
|
||||
|
||||
**输出**
|
||||
|
||||
![在 Windows 中运行一个简单的 Python 程序][11]
|
||||
|
||||
### 结束语
|
||||
|
||||
我希望这个简单的初学者指南能够帮助你在 Windows 中安装 Python,验证安装并运行你的第一个程序。
|
||||
|
||||
如果你遇到问题,请在下面的评论栏中告诉我。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.debugpoint.com/install-python-windows/
|
||||
|
||||
作者:[Arindam][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.debugpoint.com/author/admin1/
|
||||
[b]: https://github.com/lkxed
|
||||
[1]: https://www.debugpoint.com/install-python-3-11-ubuntu/
|
||||
[2]: https://www.debugpoint.com/complete-guide-how-dual-boot-ubuntu-windows/
|
||||
[3]: https://www.python.org/downloads/
|
||||
[4]: https://www.debugpoint.com/wp-content/uploads/2023/01/How-to-locate-Python-set-up.jpg
|
||||
[5]: https://www.debugpoint.com/wp-content/uploads/2023/01/Install-Python-step-1.jpg
|
||||
[6]: https://www.debugpoint.com/wp-content/uploads/2023/01/Install-Python-step-2.jpg
|
||||
[7]: https://www.debugpoint.com/wp-content/uploads/2023/01/Python-version-on-Windows.jpg
|
||||
[8]: https://www.debugpoint.com/wp-content/uploads/2023/01/Open-Environment-variable-Settings.jpg
|
||||
[9]: https://www.debugpoint.com/wp-content/uploads/2023/01/Check-Python-Environment-PATH-Values-in-Windows.jpg
|
||||
[10]: https://www.debugpoint.com/5-best-python-ide-code-editor/
|
||||
[11]: https://www.debugpoint.com/wp-content/uploads/2023/01/Running-a-simple-Python-program-in-Windows.jpg
|
Loading…
Reference in New Issue
Block a user