mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge pull request #28431 from lkxed/20230113-0-How-to-Install-Python-on-Windows--Beginner-s-Guide-
[手动选题][tech]: 20230113.0 ⭐️ How to Install Python on Windows [Beginner’s Guide].md
This commit is contained in:
commit
d7588f07d5
@ -0,0 +1,147 @@
|
||||
[#]: 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: " "
|
||||
[#]: 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
|
Loading…
Reference in New Issue
Block a user