How To Run Python In Windows
Introduction
Python is a widely used loftier-level programming linguistic communication kickoff launched in 1991. Since then, Python has been gaining popularity and is considered as ane of the most popular and flexible server-side programming languages.
Unlike near Linux distributions, Windows does not come with the Python programming linguistic communication by default. Nevertheless, you lot can install Python on your Windows server or local machine in just a few easy steps.
Prerequisites
- A system running Windows x with admin privileges
- Command Prompt (comes with Windows by default)
- A Remote Desktop Connection app (use if you lot are installing Python on a remote Windows server)
Python three Installation on Windows
Step 1: Select Version of Python to Install
The installation process involves downloading the official Python .exe installer and running information technology on your organisation.
The version you lot need depends on what you want to exercise in Python. For example, if you are working on a project coded in Python version 2.6, you probably need that version. If you are starting a project from scratch, you accept the freedom to choose.
If yous are learning to code in Python, we recommend you download both the latest version of Python ii and three. Working with Python 2 enables yous to work on older projects or test new projects for backward compatibility.
Annotation: If y'all are installing Python on a remote Windows server, log in via Remote Desktop Protocol (RDP). Once you lot log in, the installation process is the same every bit for a local Windows automobile.
Pace 2: Download Python Executable Installer
- Open your web browser and navigate to the Downloads for Windows section of the official Python website.
- Search for your desired version of Python. At the time of publishing this article, the latest Python three release is version 3.seven.3, while the latest Python 2 release is version 2.seven.16.
- Select a link to download either the Windows x86-64 executable installer or Windows x86 executable installer. The download is approximately 25MB.
Note: If your Windows installation is a 32-bit arrangement, you need the Windows x86 executable installer. If your Windows is a 64-flake version, yous need to download the Windows x86-64 executable installer. At that place is nothing to worry about if you lot install the "wrong" version. You tin can uninstall i version of Python and install another.
Step 3: Run Executable Installer
1. Run the Python Installer once downloaded. (In this instance, we take downloaded Python 3.7.3.)
2. Make sure you lot select the Install launcher for all users and Add Python 3.7 to PATH checkboxes. The latter places the interpreter in the execution path. For older versions of Python that practice not back up the Add Python to Path checkbox, come across Step 6.
3. Select Install Now – the recommended installation options.
For all recent versions of Python, the recommended installation options include Pip and IDLE. Older versions might not include such boosted features.
4. The next dialog volition prompt you to select whether to Disable path length limit. Choosing this option volition allow Python to featherbed the 260-character MAX_PATH limit. Effectively, it will enable Python to employ long path names.
The Disable path length limit option will not touch any other arrangement settings. Turning it on will resolve potential name length issues that may arise with Python projects adult in Linux.
Step 4: Verify Python Was Installed On Windows
- Navigate to the directory in which Python was installed on the system. In our case, information technology is C:\Users\Username\AppData\Local\Programs\Python\Python37 since we have installed the latest version.
- Double-click python.exe.
- The output should exist similar to what you can meet beneath:
Note: Y'all can also check whether the installation was successful by typing python –V
in Command Prompt. The output should display your installed version of Python. In our case, it is "Python 3.7.3."
Step v: Verify Pip Was Installed
If you lot opted to install an older version of Python, it is possible that it did not come with Pip preinstalled. Pip is a powerful package management system for Python software packages. Thus, make sure that you have information technology installed.
We recommend using Pip for virtually Python packages, especially when working in virtual environments.
To verify whether Pip was installed:
- Open the Offset menu and type "cmd."
- Select the Command Prompt application.
- Enter
pip -V
in the console. If Pip was installed successfully, you should run across the following output:
Pip has not been installed all the same if you become the post-obit output:
'pip' is not recognized as an internal or external control, Operable programme or batch file.
If your version of Python is missing Pip, see our article How to Install Pip to Manage Python Packages on Windows.
Step six: Add together Python Path to Environs Variables (Optional)
We recommend you go through this footstep if your version of the Python installer does not include the Add Python to PATH checkbox or if yous have not selected that option.
Setting upward the Python path to arrangement variables alleviates the demand for using full paths. It instructs Windows to look through all the PATH folders for "python" and observe the install binder that contains the python.exe file.
i. Open up the Get-go carte du jour and start the Run app.
two. Blazon sysdm.cpl and click OK. This opens the System Backdrop window.
3. Navigate to the Advanced tab and select Environment Variables.
four. Under System Variables, find and select the Path variable.
v. Click Edit.
six. Select the Variable value field. Add the path to the python.exe file preceded with a semicolon (;). For example, in the epitome beneath, we have added ";C:\Python34."
7. Click OK and shut all windows.
By setting this up, you can execute Python scripts like this: Python script.py
Instead of this: C:/Python34/Python script.py
As you can see, information technology is cleaner and more than manageable.
Pace 7: Install virtualnv (Optional)
You have Python, and y'all accept Pip to manage packages. At present, y'all demand one terminal software package - virtualnv. Virtualnv enables y'all to create isolated local virtual environments for your Python projects.
Why use virtualnv?
Python software packages are installed arrangement-wide by default. Consequently, whenever a unmarried project-specific package is inverse, it changes for all your Python projects. Yous would want to avoid this, and having separate virtual environments for each project is the easiest solution.
To install virtualnv:
ane. Open the Start card and type "cmd."
two. Select the Command Prompt awarding.
3. Type the following pip
command in the panel:
C:\Users\Username> pip install virtualenv
Upon completion, virtualnv is installed on your organization.
Conclusion
In this tutorial, we detailed how to install Python iii.vii.3 on Windows. If you lot are installing a dissimilar version of Python, y'all can expect a similar process.
To upgrade Python to a newer version, check our article how to upgrade Python to three.9.
Call up, choose your version carefully, brand certain that you have Pip installed, and use virtual environments when developing multiple projects on a single system.
Want to try out some other new generation, server-side scripting languages? Check out How to Install Ruby-red on Windows 10.
Happy coding!
Was this article helpful?
Yes No
How To Run Python In Windows,
Source: https://phoenixnap.com/kb/how-to-install-python-3-windows
Posted by: allisonlaving1985.blogspot.com
0 Response to "How To Run Python In Windows"
Post a Comment