- 1 Download Python
- 2 OpenPGP Public Keys
- 3 Other Useful Items
- 4 Want to contribute?
- 5 Python on Windows for beginners
- 6 Set up your development environment
- 7 Install Python
- 8 Install Visual Studio Code
- 9 Install Git (optional)
- 10 Hello World tutorial for some Python basics
- 11 Hello World tutorial for using Python with VS Code
- 12 Create a simple game with Pygame
- 13 Resources for continued learning
- 14 Feedback
- 15 How to Install Python on Windows 10
- 16 Step 1: Download the Python Installer binaries
- 17 Step 2: Run the Executable Installer
- 18 Step 3: Add Python to environmental variables
- 19 Step 4: Verify the Python Installation
- 20 How to install Python on Windows?
- 21 How to Install Python on Windows
- 22 Which Version Do You Need?
- 23 How to Install Python 2
- 24 How to Install Python 3
- 25 Adjust System Variables So You Can Access Both Python Versions From the Command Line
- 26 How to install Python in Windows?
- 27 Step 1 − Select Version of Python to Install
- 28 Step 2 − Download Python Executable Installer
- 29 Step 3 − Run Executable Installer
- 30 Step 4 − Verify Python is installed on Windows
- 31 Step 5 − Verify Pip was installed
- 32 How to Install Python on Windows?
- 33 Python Download and Installation Instructions
- 34 Python: Version 3.9.6
- 35 How To Install Python 3 on Windows 10
- 36 Prerequisites
- 37 Step 1 — Opening and Configuring PowerShell
- 38 Step 2 —Installing the Package Manager Chocolatey
- 39 Step 3 —Installing the Text Editor nano (Optional)
- 40 Step 4 —Installing Python 3
- 41 Step 5 —Setting Up a Virtual Environment
- 42 Step 6 — Creating a Simple Program
- 43 Conclusion
OpenPGP Public Keys
The release manager or binary builder signs source code and binary executables with their OpenPGP key, and the files are then made available for download. Release files for presently supported versions are signed by the individuals or organizations listed below:
- The following people contributed to this work: Pablo Galindo Salgado (3.10.x and 3.11.x source files and tags) (key id:64E628F8D684696D)
- Steve Dower (Windows binaries) (key id:FC62 4643 4870 34E5)
- Ukasz Langa (3.8.x and 3.9.x source files and tags) (key id:B269 95E3 1025 0568)
Release files for previous releases that have already reached the end of their life cycle may have been signed by one of the following individuals or organizations:
- The following key ids are used by the following people: Anthony Baxter (key id: 0EDD C5F2 6A45 C816)
- Georg Brandl (key id: 0A5B 1018 3658 0288)
- Martin v. Löwis (key id: 6AF0 53F0 7D9D C8D2)
- Ronald Oussoren (key id: C9BE 28DE E6DF 025C)
The public keys of someone can be imported from a public keyserver network server that you trust using a command like as:gpg -recv-keysor, in many situations the public keys can also be available atkeybase.io, which is a keybase.io service. It is recommended that you include a link to both the downloading file and a detached signature file on the version-specific download sites. Obtaining both files and then using the following command will validate the legitimacy of the download: GnuPG -verify Python-3.6.2.tgz.asc Remember that you must use the name of the signature file, and you should use the signature file that corresponds to the download that you are confirming (if applicable).
- This document is intended for GnuPG and Unix command-line users.
Other Useful Items
- Are you looking for Python modules from third parties? Many of these may be found in the Package Index
- You may see the standard documentation online or download it in a variety of forms, including HTML, PostScript, PDF, and others. See the mainDocumentationpage for further information. The website python.org provides information on tools for unpacking archive files
- These programs are accessible for download. Tip: Even if you download a binary that is ready-made for your platform, it is a good idea to also obtain the source code. Browse the standard library (the subdirectoryLib) as well as the standard collections of demos (Demo) and tools (Tools) that are included with it using this command-line interface. Many things may be learned from the source code
- Also, there is a collection of Emacs packages that the Emacsing Pythoneer would find useful. This comprises primary editing modes for Python, C, C++, Java, and other programming languages, as well as Python debugger interfaces and other features. Most packages are compatible with Emacs and XEmacs
- However, some are not.
Want to contribute?
Do you want to make a contribution? You may learn more about how Python development is controlled by reading the Python Developer’s Guide.
Python on Windows for beginners
Continue to the main content This browser is no longer supported by the manufacturer. You may benefit from the newest features, security updates, and technical support by switching to Microsoft Edge from Internet Explorer.
Please rate your experience
The information you provide will be forwarded to Microsoft: By clicking the submit button, your input will be used to improve Microsoft products and services in the future. Policy on personal information. Thank you very much.
In this article
Beginning Python programmers will find the following tutorial useful as a step-by-step guide to getting started.
Set up your development environment
Python is a programming language that we recommend for novices who are new to it. You may download Python from the Microsoft Store. Although the Python3 interpreter is used when installing through the Microsoft Store, the installation process manages the configuration of the current user’s path (thereby eliminating the requirement for administrative privileges) and provides automatic updates in addition to the basic interpreter. When working in an educational environment or as a member of an organization that controls rights or administrative access on your computer, this is extremely useful.
As an alternative to installing and using Python directly on Windows, we propose installing and using Python using the Windows Subsystem for Linux.
If you’re interested in automating typical chores on your operating system, check out our guide: Automating Common Tasks on Your Operating System Learn how to use Python for scripting and automation on Windows by following this tutorial.
Alternatively, consider installing an alternative, such as Anaconda, Jython, PyPy, WinPython, IronPython, or another Python distribution. The use of an alternate Python implementation is only recommended when you are a more experienced Python programmer who has a specific cause for doing so.
Installing Python from the Microsoft Store is as follows:
- Start by going to your Startmenu (the lower-left Windows icon), typing “Microsoft Shop,” and then selecting the link to access the store. As soon as the store is open, selectSearch from the upper-right menu and type “Python” into the search box. Choose the version of Python you’d want to use from the results shown under the Apps heading. Unless you have a compelling reason not to, we recommend that you utilize the most recent version (such as aligning with the version used on a pre-existing project that you plan to work on). Once you’ve decided the version you want to install, click on the Get button. Once Python has completed the download and installation procedure, launch Windows PowerShell by selecting it from the Start menu (lower left Windows icon). Once PowerShell is launched, typepython -version to verify that Python3 has been successfully installed on your computer. Spip, the standard package manager, is included in the Python installation from the Microsoft Store. Pip is a Python package manager that allows you to install and manage extra packages that are not included in the Python standard library. You may use the command pip -version to validate that you also have pip accessible to install and manage packages.
Install Visual Studio Code
VS Code is a text editor and integrated development environment (IDE) that includes features such as IntelliSense (a code completion aid), Linting (which helps you avoid making errors in your code), Debug support (which helps you find errors in your code after you run it), Code snippets (templates for small reusable code blocks), and Unit testing (which allows you to test your code’s interface with different types of input).
The integrated terminal in Visual Studio Code allows you to open a Python command line using Windows Command Prompt, PowerShell, or any other command line interface you like, allowing you to maintain a fluid workflow between your code editor and command line.
- To get started, download VS Code for Windows from the following link:
- Once Visual Studio Code has been installed, you must also install the Python extension for it to work properly. To install the Python extension, either open VS Code and search forPythonin the extensions menu (Ctrl+Shift+X), or pick theVS Code Marketplace link. Due to the fact that Python is an interpreted language, you must provide the interpreter that will be used in order for Python code to be executed. Unless you have a compelling need to use a different version of Python, we recommend that you use the most recent version available to you. Once you’ve completed the installation of the Python extension, enter the Command Palette (Ctrl+Shift+P) and pick a Python 3 interpreter by typing the commandPython: Select Interpreter from the drop-down menu, and then the command. If the Python Environment option is accessible on the bottom Status Bar, you can utilize it as well if it is not already chosen (it may already show a selected interpreter). There is a list of accessible interpreters that VS Code may discover on its own, as well as virtual environments, when the command is executed. If you don’t find the Python interpreter you’re looking for, check out Configuring Python environments. To access the terminal in Visual Studio Code, choose ViewTerminal from the context menu, or press Ctrl+’ on your keyboard (using the backtick character). PowerShell is the default terminal
- However, other options are available. Open Python by typing the command:python
- Into the terminal of your Visual Studio Code application. Try out the Python interpreter by typing the following: print (“Hello World”). Python will return the sentence “Hello World” that you entered.
Install Git (optional)
The Git version control system is supported by Visual Studio Code if you want to interact with others on your Python code or host your project on an open-source site (such as GitHub). The Source Control tab in Visual Studio Code keeps track of all of your changes and includes typical Git functions (add, commit, push, and pull) directly in the user interface. You must first install Git in order for the Source Control panel to function properly.
- Git for Windows may be obtained from the git-scm website and installed. An Install Wizard is available, which will walk you through the process of setting up your Git installation by asking a number of questions. The default settings should be used unless you have a good purpose for altering something
- Otherwise, we urge that you leave them alone. In the event that you have never dealt with Git before, the GitHub Guides can assist you in getting started
Hello World tutorial for some Python basics
“Python is a high-level programming language, and its primary design philosophy is all about code readability and a syntax that allows programmers to express concepts in a few lines of code,” according to the language’s developer, Guido van Rossum. Python is a computer programming language that is interpreted. In contrast to compiled languages, in which the code you write must first be converted into machine code before it can be executed by your computer’s processor, Python code is delivered immediately to an interpreter and executed directly by the computer’s CPU.
Let’s give it a go!
- Enterpython on the PowerShell command line to launch the Python 3 interpreter. Keep your PowerShell command line open. (Some instructions specify that the commandpyorpython3 be used
- Nevertheless, this should also work.) You’ll know you’ve succeeded when you see a prompt with three greater-than symbols appear on the screen
- In Python, there are multiple built-in functions that enable you to modify strings in various ways. Create a variable with the following syntax: variable = ‘Hello World!’ To start a new line, use the Enter key. With the print command, you may print your variable (variable). This will result in the display of the words “Hello, World!” The length of your string variable, or how many characters are utilized, may be determined with:len (variable). This will show that a total of 12 characters have been utilized. Notice that the blank space was treated as a character in the overall number of characters.)
- Upper-case letters can be used to convert a string variable to upper-case letters (). Now, using the variable.lower() function, you may transform your string variable to lower-case letters. Count the number of times the letter “l” appears in the string variable you created: variable.count(“l”)
- Find a specific character in your string variable using the variable.discover(“!”) function. For example, find the exclamation point with the variable.find(“!”). This will reveal that the exclamation point may be located in the eleventh character of the string, as seen below. The exclamation point is replaced with a question mark using the function variable.replace(“!”, “?”)
- To terminate Python, you can use the exit() and quit() functions, as well as the Ctrl-Z keyboard shortcut.
I hope you had a good time experimenting with some of the built-in string alteration techniques in Python. Create a Python program file and run it using Visual Studio Code to see how it works.
Hello World tutorial for using Python with VS Code
The Visual Studio Code team has put together a fantasticGetting Started with Pythontutorial that walks you through the steps of creating a Hello World program in Python, running the program file, configuring and running the debugger, and installing packages such as matplotlib andnumpyto create a graphical plot inside a virtual environment, all in a virtual environment.
- To begin, launch PowerShell and create an empty folder named “hello.” Then browse into this folder and open it in Visual Studio Code as seen below: hello cd hello code
- Mkdir hello cd hello code Once VS Code has been launched and your newhellofolder has been displayed in the left-sideExplorerwindow, start a command line window in the bottom panel of VS Code by hitting Ctrl+'(using the backtick character) or by selectingViewTerminal from the context menu. When you start VS Code in a folder, that folder is referred to as your “workspace.” User settings that are particular to a workspace are kept in the file.vscode/settings.json, which is different from user settings that are stored worldwide. Continue reading the tutorial in the VS Code documentation: Create a source code file for the Python Hello World program
Create a simple game with Pygame
Pygame is a well-known Python library for generating games, which encourages students to learn programming while also producing something entertaining. Python shows visuals in a separate window, therefore it will not function properly under the command-line-only approach taken by the WSL. However, if you followed the instructions in this guide and installed Python from the Microsoft Store, it would work properly.
- If you have Python installed, you can install pygame from the command line (or the terminal from within VS Code) by typingpython -m pip install -U pygame -user
- Once you have Python installed, you can install pygame from the command line (or the terminal from within VS Code). Run a sample game to verify that the installation was successful:python -m pygame.examples.aliens
- If everything goes according to plan, the game will open a window. You should close the window when you’re through with the game.
Here’s how to get started with creating your own video game.
- Open PowerShell (or the Windows Command Prompt) and create a new folder named “bounce” in the current directory. Create a new file named “bounce.py” in this folder by navigating to it. Open the folder in Visual Studio Code as follows: mkdir bounce is an abbreviation for Make a Directory. cd bounce is an abbreviation for CD bounce. code for the new-item bounce.py
- Fill in the blanks with the following Python code (or copy and paste it from another source) in Visual Studio Code: Import SYSTEMS. pygame pygame.init() The dimensions of the object are width and height, respectively. The dimensions of the object are 1 dx, 1 dy, 1 x= 163, and 120, respectively. black is the color of ink (0,0,0) white coloration = (255,255,255) While 1:for event in pygame.event.get(): if event.type = pygame.QUIT: if event.type = pygame.QUIT: if event.type = pygame.QUIT: sys.exit()x += dx y += dyif x0 or xwidth: dx = -dxif y0 or ywidth: dx = -dxif y0 or ywidth: sys.exit()x += dx y += dyif x0 or xwidth: sys.exit()x += dx fill dy = -dyscreen.fill dy = height of the screen (black) The following code is used to draw a circle on the screen: screen, white, (x,y), 8. pygame.display.flip()
- Save it under the name bounce.py. Run it by executing the following commands in the PowerShell terminal:python bounce.py
Adjust some of the numbers to watch what happens to your bouncing ball as a result of your adjustments.
More information about writing games with pygame may be found at pygame.org.
Resources for continued learning
We propose the following resources to help you learn more about Python programming on Windows and to help you keep up with your learning.
Online courses for learning Python
- Introduction to Python on the Microsoft operating system Explore the interactive Microsoft Learn platform and earn experience points for completing this program, which covers the fundamentals of writing basic Python code, declaring variables, working with console input and output, and using the python interpreter. People who don’t have have a Python programming environment set up will find this to be a wonderful place to start because of the interactive sandbox environment available. Programming in Python with Pluralsight: 8 Courses and 29 Hours: The Python learning path on Pluralsight provides online courses covering a number of subjects relevant to Python, as well as a tool to assess your current level of proficiency and identify skill gaps. LearnPython.org Tutorials: With these free interactive Python courses from the guys at DataCamp, you can get started studying Python right away without having to install or configure anything. The Python.org Tutorials: Provides an informal introduction to the fundamental principles and features of the Python programming language and operating system
- Getting Started with Python on Lynda.com: A fundamental introduction to Python
Working with Python in VS Code
- How to use VS Code’s autocomplete and IntelliSense support for Python, as well as how to adjust their behavior, are covered in this article. Alternatively, simply turn them off. The process of running a program that will analyze code for potential problems is referred to as linting Python. Learn about the many types of linting support that Visual Studio Code provides for Python, as well as how to set it up. Python debugging is a simple process. A computer program’s debugging procedure involves the identification and removal of defects from the software. It is covered in this article how to initialize and configure debugging for Python in Visual Studio Code, how to establish and validate breakpoints, how to attach a local script, how to conduct debugging for different app types or on a remote computer, and some basic troubleshooting. Creating and running your tests, troubleshooting your tests, and setting up your test configurations are all covered in this chapter on unit testing Python.
Feedback may be sent and viewed for
How to Install Python on Windows 10
Python is a programming language that is easy to install and use on Windows 10. The installation technique is comprised of only three steps: 1.
- Download the binaries from this site. Install Python by running the Executable installer and adding it to the PATH environment variables.
To install Python, you must first download the official Python executable installer from the Python website. Then you must run this installer and complete the rest of the installation procedures. Finally, you may set the PATH variable to point to the Python executable from the command line. You have the option of selecting the version of Python you want to install. When installing Python, it is advised that you use the most recent version, which is 3.7.3 at the time of writing this article.
Step 1: Download the Python Installer binaries
- Open the official Python website in a web browser to learn more about Python. For Windows, choose the Downloads tab from the Start menu. Make sure you use the most recent Python 3 release. The most recent Python 3.7.3 version is used in this example. If you are using a 32-bit installer, you should click on the link to download the Windows x86 executable installer. If your Windows installation is a 64-bit system, then you should download the Windows x86-64 executable installer
- Otherwise, go here.
Step 2: Run the Executable Installer
- Upon completion of the Python installer download, launch the Python installer
- Check the option that says “Install launcher for all users.” Additional options include checking theAdd Python 3.7 to pathcheck box to include the Python interpreter in the execution path
- And Select “Customize installation” from the drop-down menu. Select the optional features by selecting the appropriate check boxes from the list below:
- Once the Python installer has been downloaded, you should start it. Uncheck the item labeled “Install launcher for all users.” To include the Python interpreter in the route of execution, you may also choose Add Python 3.7 to Pathcheck box. Configure installation according to your preferences. Select the extra features by selecting them from the drop-down menus that appear below:
- When you click Next, you will be taken to the Advanced Options section of the Python installation. Select the check boxes for Install for all users and Add Python to environment variables in this section. You may also pick additional options such as Associating files with Python, Creating shortcuts for installed apps, and other complex choices. Make a note of the location of the Python installation directory that was presented during this stage. You’d need it for the following phase, of course. After making your selections from the Advanced options, click Install to begin the installation process. Upon completion of the installation, you will get a popup titledPython Setup Successful
Step 3: Add Python to environmental variables
The final (and optional) step in the installation procedure is to modify the System Environment variables to include the Python Path. This step is necessary in order to access Python from the command line. It is possible to skip this step if you have already added Python to your environment variables while configuring the Advanced options during the installation procedure. If this is not the case, the following procedure must be followed manually. Advanced system settings may be found by searching for “advanced system settings” in the Start menu.
In the “System Properties” window, select the “Advanced” tab, and then select the “Environment Variables” button to the right of the “System Properties” button.
If you followed the instructions above to the letter, Python will be installed in the following locations:
- C:Program Files (x86) is the location of the program. Python37-32 is intended for use with 32-bit operating systems. Python37-32 may be found in the C:Program FilesPython37-32 directory for 64-bit installations.
If you have installed a different version of Python, the folder name may be different from “Python37-32.” Look for a folder with a name that begins with the letter Python. As seen below, add the following items to the PATH variable to complete the path:
Step 4: Verify the Python Installation
Your installation of Python 3.7.3 on Windows 10 has now been completed successfully. Either through the command line or using the IDLE application that is installed as part of the installation, you may determine whether the Python installation was successful. Look for the command prompt and enter the word “python.” The fact that Python 3.7.3 has been successfully installed may be seen. The IDLE program may also be accessed by searching for “Python” in the start menu and selecting it from the list (Python 3.7 64-bit).
How to install Python on Windows?
Introduction to the Python Programming Language is required. Prior to discussing how to install Python3 on Windows, let’s have a look at the fundamentals of Python as a programming language. Python is a general-purpose programming language with a high level of abstraction that is frequently used.
Python is a programming language that allows you to operate more quickly and efficiently when integrating systems together. Python 2 and Python 3 are the two most widely used Python versions. Both are pretty distinct from one another.
Getting started with Python
Python is far less difficult to code in and learn. Python applications may be created in any plain text editor, such as notepad, notepad++, or anything else of the kind, and run on any computer. One may also utilize an online integrated development environment (IDE) for creating Python programs, or they can even install one on their machine, to make it more viable to create these codes because IDEs give a variety of functions such as an intuitive code editor, debugger, compiler, and so on. Before one can begin creating Python Codes and executing a variety of exciting and helpful actions, one must first ensure that Python has been installed on their computer.
What if Python already exists? Let’s check
In order to determine whether or not your device has Python pre-installed, just navigate to the Command line (search for cmdin the Run dialog(+ R)). Then, execute the following command: python -version is an abbreviation for Python version. If Python is already installed, the program will create a message indicating which Python version is now available for use.
Download and Install Python:
You must first download the software before proceeding with the installation process. Python for Windows is available for download at python.org in all of its versions. Download the appropriate version and then follow the on-screen directions to complete the installation procedure. The installation process has begun. In order to check that the installation was successful, run the following instructions in your Terminal. python Consider the following example of a basic Hello World program. Output: Pay close attention, geeks!
To begin with, make sure you are well prepared for your interview.
Moreover, to get started on your Machine Learning journey, enroll in theMachine Learning – Fundamental Level Course.
How to Install Python on Windows
Python is not included in the Windows operating system, but that does not rule out the possibility that Windows users will find the versatile programming language beneficial. However, it is not quite as simple as just installing the most recent version, so let’s make sure you have the appropriate tools for the job at hand. Python, which was first released in 1991, is a popular high-level programming language that is used for general-purpose computing. Because of its emphasis on readability in its design philosophy, it has long been a favorite of both hobby coders and serious programmers.
Which Version Do You Need?
Unfortunately, there was a large upgrade to Python few years ago that resulted in a significant divide between the various Python releases. If you’re new to the area, this may seem a little perplexing, but don’t be concerned. We’ll guide you through the process of installing both major releases. When you go to the Python for Windows download page, you’ll see that it’s divided into two sections. The repository asks you if you want the newest edition of Python 2 or Python 3 right at the top, square, and center of the page (2.7.13 and 3.6.1, respectively, as of this tutorial).
- Isn’t it true that newer is better?
- The version you choose will be determined by your final aim.
- Python 2.7 is required to run the MCDungeon project, which is written in Python and cannot be run with any other version of Python.
- If your aim is to get some project up and running that has a “.py” extension, there’s a very, very strong chance you’ll require Python 2.7 to do it.
- While you may work with the most up-to-date version of the language, you can also execute older Python scripts (and test backwards compatibility for newer projects).
- If you are certain that you just require a specific version of Python, you can download simply Python 2 or Python 3.
- You’ll find a “x86-64” installer under the main entry for both versions, as seen in the screenshot below.
This installer will automatically install the proper 32-bit or 64-bit version of the software on your computer (if you want to learn more about the differences between the two, see the following link for more reading).
How to Install Python 2
It takes minutes to set up Python 2, and unlike previous versions, the installer will even configure the path variable for you (which we’ll cover in more detail later). Download and launch the installer, then pick “Install for all users” from the drop-down menu and press “Next.” Leaving the directory as “Python27” on the directory selection screen, continue by clicking “Next.” On the customization page, scroll down to the “Add python.exe to Path” section and then pick “Will be installed on local hard drive” from the drop-down menu.
After this moment, you are no longer required to make any more decisions.
When the installation is complete, you can verify that the installation was successful by opening Command Prompt and putting the following command into it: victorious in python It is perfectly acceptable to end here if all you want is Python 2.7 for some reason.
How to Install Python 3
If you wish to study Python 3, which is the most recent version, you’ll need to install Python 3. No difficulties will arise if you want to install it with Python 2.7, so go ahead and download and run the installer right now. Installing Python 3.6 is as simple as selecting the “Add Python 3.6 to PATH” option on the first page and clicking “Install Now.” After that, you’ll have to pick a choice. The restriction on the MAX PATH variable is removed by selecting the “Disable path length limit” option from the drop-down menu.
- This is useful since many Python programmers work on Linux and other *nix systems where the length of path names is not a concern.
- RELATED: Instructions on how to make Windows 10 accept file paths that are longer than 260 characters We encourage that you go ahead and pick this alternative.
- And, if you’d want to learn more about the subject before making a decision, you may do so by clicking here.
- In the event that you’re installing both versions, you’ll need to make the short adjustment described in the next section.
Adjust System Variables So You Can Access Both Python Versions From the Command Line
It is entirely optional to finish this phase of the lesson, but it will enable you to rapidly access both versions of Python from the command line. Perhaps you observed a little oddity after installing both versions of Python on your computer? The fact that we enabled the system path for both Python installs does not prevent you from entering “python” at the command line from bringing up Python 2.7. Why this happens is straightforward: the variable (whether automatically altered by an installer or manually tweaked) simply links to a directory, and every executable in that directory is converted into a command line option.
- The system path takes priority over the user path, if any or both of these variables are specified for the system and for the user, respectively.
- To access advanced system settings, start by pressing the Start button, typing “advanced system settings,” and then selecting the “View advanced system settings” option.
- Python 3 is listed in the “User variables” section, but Python 2 is listed in the “System variables” portion of this document.
- The easiest solution (although one with the least amount of functionality) is to just delete the item for the version of Python that you intend to use the least amount of.
- Alternatives include making another adjustment that will allow us to use “python” for Python 2 and “python3” for Python 3, as well as accessing “python” for Python 2.
- To do this, make a copy of the “python.exe” file and rename it (not the original) to “python3.exe.” Using the command “python3 –version,” start a new command prompt (the environmental variables will be refreshed with each new command prompt you open).
- Using the “python” command at the Command Prompt when you want to use Python 2.7 is now possible; using the “python3” command when you want to use Python 3 is now possible.
- If you’re not familiar with altering variables, we recommend that you review our guide first.
This is because the apps in the /scripts/ subfolder for both versions of Python rely on that filename and will fail if it is not present. After a little installation and configuring, you’ll have both versions of Python installed and ready to go for any Python project you’d want to take on next.
How to install Python in Windows?
Python is a high-level programming language that is commonly used today. Python must first be installed on our machine before we can begin writing and running code in it. Python may be installed on Windows by following a number of simple steps.
Step 1 − Select Version of Python to Install
A variety of Python versions are available with slight variances in the syntax and operation of the many Python versions on the market today. We must select the version of the software that we wish to utilize or that we require. Python 2 and Python 3 are both available in a number of different versions.
Step 2 − Download Python Executable Installer
Navigate to the Download for Windows section of the official python website () using a web browser on your computer. All of the Python versions that are currently available will be included. Choose the version that you desire and click on the Download button. Consider the following scenario: we choose the Python 3.9.1 version. Following the click of the download button, a list of available executable installers with varying operating system criteria will be shown. Select the installer that corresponds to your machine’s operating system and download the installation from there.
The file is less than 30MB in size when downloaded.
Step 3 − Run Executable Installer
We downloaded and installed the Python 3.9.1 Windows 64-bit installation package. Start the installation process. Make sure that both of the checkboxes at the bottom are selected before clicking on Install New. The installation procedure begins as soon as you click the Install Now button. Upon completion of the installation procedure (which will take a few minutes), the following screen will be displayed, indicating that everything went smoothly.
Step 4 − Verify Python is installed on Windows
In order to determine whether Python has been successfully installed on your system. Take the actions that are outlined.
- Start by opening the command prompt. Enter the word “python” into the search box
- If the Python programming language has been successfully installed on your Windows system, the version of Python that you have installed will be shown.
Step 5 − Verify Pip was installed
Pip is a robust package management system for Python software packages that is used by many other programming languages. As a result, ensure that it is properly installed. Follow the instructions below to see if pip has been successfully installed.
- Start by opening the command prompt. To see if pip has been installed, use pip –V into your terminal. If pip has been successfully installed, the following output will appear:
The Python and pip packages have been successfully installed on our Windows PC. Published on March 10, 2021 at 13:50:31 UTC.
- Questions that are related Answers
- How to Setup Python on a Windows Computer
- Installing MongoDB with Python on Windows is covered in detail in this guide. How to Install a C++ Compiler on a Computer Running Windows
- How to use PowerShell to install Windows features on a computer
- Describes the process of installing OpenCV for C++ on a Windows computer. Instructions on how to install a Windows service in C using the Windows command prompt
- Installing the Imagick/imagemagick PHP extension for Windows 10 is described in detail here. How to use PowerShell to install the Azure CLI on a Windows computer
- How to install Matplotlib on Windows without having to install Qt by utilizing Conda. How to install the Java Development Kit (JDK) on Windows and configure the environment variables
- In this tutorial, you will learn how to install Tkinter in Python. How to install OpenCV in Python
- How to use OpenCV in Python
- What is the best way to install matplotlib in Python? How to install a Python Module
- What is Python
- Learn how to set up Python modules in the Cygwin environment.
How to Install Python on Windows?
Python has quickly risen to become one of the most widely used programming languages in the twenty-first century. It is being utilized for a variety of objectives across a wide range of business sectors. Developersuse Python is a programming language used for constructing programs and websites. Data Engineers make use of Python is a programming language used for data analysis, statistical analysis, and the construction of machine learning models. Python is typically not installed by default on Windows systems.
- Following that, click on theDownloadstab and then on theWindowsoption.
- Because I am running a 64-bit operating system, I will choose “Windows x86-64 executable installer.” Once the download of the executable file is complete, you may run it to begin the installation of Python.
- If you want to save the installation file in a different location, select Customize installation from the drop-down menu; otherwise, selectInstall Now from the menu bar.
- As soon as the installation is complete, the pop-up box shown below will appear: The installation went smoothly.
- Go to the Start menu and type Python into the search box.
- Let’s open IDLE, which is an abbreviation for Integrated Development Environment, and run a basic print statement to demonstrate how to do this.
- You can write a single line of code in the Python Shell and have it executed by pressing the Enter key.
- The command-line will be used to produce “Hello, world.” Python’s command-line interpreter and interactive development environment (IDLE) are excellent for any newcomer to start with.
- You may also test out theAnaconda Python Distribution, which includes theJupyter Notebook and theSpyder programming language.
I hope this was useful, and that you were able to successfully download and install Python on Windows as a result of it. Sign up for Simplilearn’s Data Science with Python Training Course today to receive additional in-depth instruction.
Python Download and Installation Instructions
Printing these instructions before starting will allow you to refer to them during the Python download and installation processes. Alternatively, you can just bookmark this page in your browser. Before executing the action described in each stage, you should thoroughly understand the instructions for that step. Python 3.9.6 is demonstrated in this post on Windows 10 in Summer 2021, including the download and installation of Python. It is recommended that you download and install the most recent version of Python.
Keep in mind that you must first install Python as a 64-bit program before installing Eclipse.
Python: Version 3.9.6
The Python download will take up around 25 Mb of disk space; save it to your computer in case you need to re-install Python later on. Python takes around 90 Mb of additional disk space after it has been installed.
- Python may be downloaded by clicking here. When you open your browser, the following page will appear: To download Python 3.9.6, click theDownload Python 3.9.6 button. The following pop-up window labeled “Opening python-3.96-amd64.exe” will display when the program is launched. To save the file, click theSave Filebutton. When the program namedpython-3.9.6-amd64.exe begins to download, it should be placed in your default download location. This file is around 25 Mb in size, therefore it may take some time to download completely if you are using a sluggish internet connection (it took me about 10 seconds over a cable modem). The following filename should display in your Downloadsfolder: Move this file to a more permanent location so that you can simply install Python (and reinstall it if required) in the future. It is entirely up to you to investigate this webpage further
- If you simply want to finish the installation, you can close the tab that is now exploring this webpage. In order to begin, follow the installation steps given below
- Double-click the icon labeled “python-3.9.6-amd64.exe” to launch the program. A pop-up window titled APython 3.9.6 (64-bit) Setup will appear. At the bottom, double-check that both the Install launcher for all users (recommended) and the Add Python 3.9 to PATHcheckboxes are selected
- Typically, only the first of these is selected by default. Alternatively, if the Python Installer detects that an earlier version of Python is already installed on your computer, the Install Now message may be replaced with an Upgrade Now message (and the checkboxes will be hidden). Identify the message that says “Install Now” or “Upgrade Now,” and then click it. When the program is launched, aUser Account Control pop-up window may appear on your computer’s screen. I was unable to capture its image, but it asks, “Do you want to allow this app to make changes to your device?” I did not capture its image. To proceed, press theYesbutton. A newPython 3.9.6 (64-bit) Setuppop-up window will appear, with aSetup Progressmessage and a progress bar, indicating that the installation has progressed. During the installation process, it will display a list of the various components that are being installed and will move the progress bar closer to completion. A newPython 3.9.6 (64-bit) Setuppop-up window will appear shortly, displaying the message “Setup was successfuly.” To close the window, click theClosebutton.
Python should now be available for use.
In order to attempt to verify installation,
- Choose C:UsersPattiSAppDataLocalProgramsPython39 (or whichever directory Python was installed in
- See the pop-up box for Installing step 1)
- And then click on the Python39 icon. Double-click the filepython.exe icon on your desktop. A pop-up window will display as a result of this action. A pop-up window with the title C:UsersPattisAppDataLocalProgramsPythonPython39python.exe opens, and inside the window, the text Python 3.9.6 appears on the first line and the text Python 3.9.6 appears on the second line (notice that it should also say 64 bit). The prompt for exit() is located at the bottom left of the window
- Type exit() into this prompt and pressenter to bring Python to a close. In case you need to reinstall Python (which is unlikely to happen), you should store the filepython-3.9.6.exe someplace on your computer.
You may now proceed to download and install the Eclipse IDE by following the on-screen directions.
How To Install Python 3 on Windows 10
Python is a computer language that is extremely flexible and can be used for a wide range of programming applications. Python was first released in 1991, and its name was inspired by the British comedy group Monty Python. The development team intended to create a language that was enjoyable to use, so they named it Python. Python is a wonderful programming language for novices and expert developers alike since it is simple to set up, written in a reasonably clear style, and provides rapid feedback on problems.
You will be guided through the process of installing Python 3 on your local Windows 10 PC and configuring a programming environment through the command line in this tutorial.
You will require a machine running Windows 10 with administrator privileges that is connected to the internet.
Step 1 — Opening and Configuring PowerShell
Our installation and setup will be done mostly using a command-line interface, which is a non-graphical manner of interacting with your computer’s hardware and software. As opposed to clicking on buttons, you will be inputting text into your computer and receiving response from your computer through text. You may change and automate many of your computer-related chores using the command line, often known as a shell. It is a vital tool for software developers and can be found in almost any operating system.
- Administrative chores are carried out by runningcmdlets, which are pronounced command-lets and are specialized classes of the.NET software framework that are capable of carrying out various actions.
- To access Windows PowerShell, you may right-click on the Start menu icon located in the lower left-hand corner of your screen and select Open with.
- When the menu appears, select “Search” from the drop-down menu and then type “PowerShell” into the search field that appears.
- The option “Run as Administrator” will be used for our purposes.
- As an administrator, you may configure the following levels of permissions for the system, which is configured to function in the most secure mode by default:
- Under the Restricted execution policy, you will not be allowed to launch scripts and PowerShell will only function as an interactive shell
- This is the default execution policy. As a result, you will be able to run any scripts or configuration files that have been signed by a trustworthy publisher, putting your computer at danger of executing malicious scripts that have been signed by a trusted publisher. Run scripts and configuration files downloaded from the internet that have been signed by trusted publishers, exposing your machine to vulnerabilities once more in the event that these trusted scripts are malicious
- RemoteSigned will allow you to run scripts and configuration files downloaded from the internet that have been signed by trusted publishers
- All scripts and configuration files obtained from the internet will be executed as soon as you indicate that you understand that the file was downloaded from the internet by clicking on the Unrestricted button. Due to the lack of a digital signature in this situation, you face the risk of your computer being compromised by running unsigned and potentially dangerous scripts obtained from the internet.
We are going to use the RemoteSigned execution policy to set the permission for the current user in such a way that PowerShell can accept downloaded scripts that we trust without granting the user access to as many resources as they would have with an Unrestricted permission, which is what we would have done with an Unrestricted permission. Let’s type the following in PowerShell: PowerShell will then prompt us to specify an execution policy, and because we want to utilize RemoteSigned, we’ll type the following into the prompt: We’ll be asked if we want to modify the execution policy once we press enter once we’ve done so.
We can verify that this succeeded by executing the following command to obtain the current permissions throughout the machine: You should be able to see something similar to this in your output: OutputScope ExecutionPolicy – – OutputScope ExecutionPolicy MachinePolicyUndefined UndefinedPolicyUndefinedProcessUndefinedUserPolicyUndefined CurrentUserRemoteSignedLocalMachineUndefined This certifies that the current user has the ability to execute trustworthy scripts that have been downloaded from the internet.
The next step will be to download the files that we will need to set up our Python programming environment in order to continue.
Step 2 —Installing the Package Manager Chocolatey
A package manager is a set of software tools that work together to automate the installation process, which includes the initial installation, software upgrades and configuration, as well as the removal of software when it is no longer required. They keep software installs in a centralized area and are capable of keeping all software packages on the system in formats that are widely accepted. Chocolatey is a command-line package manager for Windows that operates in the same way that apt-getdoes typically on Linux.
First, let us read the script to ensure that we are satisfied with the modifications it will make to our computer before we proceed with installation.
We’ll construct a WebClient object named$script(you can call it whatever you like as long as the first character is$), which will share the following Internet connection settings with Internet Explorer: Now, let’s have a look at the possibilities we have by passing the object via the Get-Memberclass function, which returns all members (properties and methods) of the WebClient object: Screenshot of the Result.
- DownloadFileAsyncMethodvoid DownloadFileAsync(uri address, string fileName), void DownloadFileAsync(ur.
- DownloadFileTaskAsyncMethodSystem.Threading.Tasks.Task Asynchronous DownloadFileTask(string address, string fileNa) is a task that downloads files in real time.
- DownloadStringAsyncMethodvoid The downloadStringAsync(uri address, void) and the downloadStringAsync(uri address, Sy DownloadStringTaskAsyncMethodSystem.Threading.Tasks.Task Sy.
- When we look at the result, we can see that theDownloadStringmethod has been identified, and we can use it to show the script and signature in the PowerShell window.
- DownloadFileAsyncMethodvoid FileDownloadAsync(uri address, string fileName), void DownloadFileAsync(ur), void DownloadFileAsync(ur), void DownloadFileAsync(ur.
- DownloadStringMethodstring DownloadString(string address), string, downloadString(string address), string We will make use of the DownloadString(uri address) function.
- DownloadStringTaskAsyncMethodSystem.Threading.Tasks.Task Sy.
Implementing this technique will look like the following: In order to pull information from the web, we use the cmdletiwrorInvoke-WebRequest As a result, the script will be sent to theiexorInvoke-Expressioncmdlet, which will run the contents of the script, which will result in the Chocolatey package manager’s installation script being executed.
Once it has been successfully installed, we may proceed to installing more tools with thechococommand if necessary.
Step 3 —Installing the Text Editor nano (Optional)
We will now install nano, a text editor that operates through a command line interface, which will allow us to develop programs from within PowerShell without having to leave the shell.
This is not a required step, since you may instead use a text editor with a graphical user interface, such as Notepad, but utilizing nano will help us become more familiar with PowerShell’s interface. Using Chocolatey, we’ll be able to install nano:
In this case, we utilized the-yflag to ensure that we automatically affirm that we wish to start the script without having to be asked. Once nano is installed, we will be able to use the thenanocommand to create new text files, and we will ultimately use it to develop our first Python program once nano is fully functional.
Step 4 —Installing Python 3
We will use Chocolatey to install Python 3 in the same way as we did with nano earlier: PowerShell will now install Python 3, which will generate output within PowerShell as the installation is taking place. Upon completion, you should see something like this: Once the procedure is complete, you should see something like this: The output environment variables (such as PATH) have been modified. Close and reopen your shell to see the changes (or type’refreshenv’ in powershell/cmd.exe to see the changes).
- If the software is installed as a ‘EXE’ file, the installation location is most likely the default.
- 0 packages were unable to be installed.
- Once the installation is complete, you’ll want to verify that Python has been successfully installed and is ready to use.
- Pip will be installed alongside Python, and it will be responsible for managing software packages for Python.
- We will use the-mflag to execute the library module as a script, which will terminate the option list, and then usepip to install the library module’s upgrade from there.
Step 5 —Setting Up a Virtual Environment
Now that we have Chocolatey, nano, and Python installed, we can proceed to setting up our development environment using thevenvmodule to get started. Virtual environments allow you to create a separate space on your computer for Python projects, allowing each of your projects to have its own set of dependencies that will not interfere with any of your other projects. This allows you to work on multiple Python projects at the same time without interfering with each other’s work. Setting up a development environment gives us more control over our Python projects, as well as over how various versions of packages are handled in different environments.
You have the ability to create as many Python programming environments as you wish on your computer.
Select the directory in which you want to store your Python programming environments, or create a new directory with the commandmkdir, as shown in the example:
With Chocolatey, nano, and Python now successfully installed, we can proceed to creating our development environment using thevenvmodule. Virtual environments allow you to create a separate space on your computer specifically for Python projects, allowing each of your projects to have its own set of dependencies that will not interfere with any of your other projects. This allows you to work on multiple Python projects at the same time without interfering with each other’s progress. When we set up a programming environment, we have more control over our Python projects, as well as over how various versions of Python packages are handled.
You have the ability to create as many Python programming environments as you like in your computer.
Select the directory in which you want to store your Python programming environments, or create a new directory with the commandmkdir, as shown in the following example: We will use thepythoncommand to execute thevenvlibrary module, which will result in the creation of a virtual environment that we will refer to as my env.
107 pyvenv.cfg These files work together to ensure that your projects are kept separate from the larger environment of your local machine, and that system files and project files do not come into contact with one another.
To make use of this environment, you must first activate it, which you may do by entering the following command, which invokes the activate script located in theScriptsdirectory: activate Your prompt will now be prefixed with the name of your environment, in this case my env: Your prompt will now be prefixed with the name of your environment, in this case my env: This prefix informs us that the environmentmy envis is presently active, which means that when we write programs in this environment, they will only utilize the parameters and packages associated with this particular environment.
Step 6 — Creating a Simple Program
Now that we’ve established our virtual environment, let’s write a simple “Hello, World!” program to test it out. In addition to ensuring that our environment is operational, this will provide us with the chance to become more comfortable with Python if we are not already familiar with it. To accomplish this, we’ll use nano and create a new file named: Once the text file has been opened in Terminal, we will write the following into it: print(“Hello, World!”) and print(“Hello, World!” Type thecontrolandxkeys to exit nano, and when requested to save the file, pressythen theenterkey to save the file.
As soon as you’ve exited nano and returned to your shell, let’s execute the following program:
Following is an example of what should be produced by the hello.py program that you just built in Terminal: Output Hello, there, World! In order to exit the environment, execute the command deactivate, and you will be taken back to your normal working location.
Congratulations! The Python 3 programming environment should now be installed on your local Windows 10 computer, and you can start working on your coding project right now!. Follow the instructions in the local programming environment guidelines forUbuntu 16.04, Debian 8, CentOS 7, or MacOS to install Python 3 on another machine. In addition, you may learn how to install Python and set up a programming environment on an Ubuntu 16.04 server, which is very important when working in development teams.