banner



How Do I Run a Python Program in Windows 10

Introduction

Python is a widely used high-level programming language first launched in 1991. Since then, Python has been gaining popularity and is considered A combined of the most popular and flexible server-side computer programming languages.

Different most Linux distributions, Windows does not come with the Python programming terminology by default. However, you can install Python on your Windows server or local machine in just a few easy steps.

Prerequisites

  • A system working Windows 10 with admin privileges
  • Command Prompt (comes with Windows by default)
  • A Remote Desktop Connection app (use if you are installing Python happening a remote Windows host)

Python 3 Instalmen on Windows

Tone 1: Select Version of Python to Install

The installation procedure involves downloading the authorized Python .exe installer and running IT connected your system.

The version you postulate depends on what you wishing to knock off Python. E.g., if you are working on a project coded in Python version 2.6, you probably need that version. If you are starting a protrude from scratch, you have the freedom to take.

If you are learnedness to encode in Python, we recommend you download some the latest reading of Python 2 and 3. Operative with Python 2 enables you to work connected older projects operating theatre try recent projects for backward compatibility.

Note: If you are installing Python on a remote Windows host, log in via Distant Desktop Protocol (RDP). Once you log in, the initiation process is the comparable Eastern Samoa for a local Windows machine.

Step 2: Download Python Executable Installer

  1. Open your browser and navigate to the Downloads for Windows section of the official Python website.
  2. Search for your desired interpretation of Python. At the time of publishing this clause, the current Python 3 release is adaptation 3.7.3, patc the in style Python 2 release is variant 2.7.16.
  3. Quality a yoke to download either the Windows x86-64 workable installer OR Windows x86 viable installer. The download is approximately 25MB.

Note: If your Windows initiation is a 32-bit system, you motivation the Windows x86 executable installer. If your Windows is a 64-bit version, you need to download the Windows x86-64 viable installer. There is nothing to headache about if you install the "wrong" version. You seat uninstall one version of Python and install another.

Step 3: Run Executable Installer

1. Run the Python Installer once downloaded. (In this example, we have downloaded Python 3.7.3.)

2. Make destined you select the Install launcher for entirely users and Add Python 3.7 to Route checkboxes. The latter places the interpretive program in the execution itinerary. For older versions of Python that do not subscribe the Add Python to Itinerary checkbox, see Pace 6.

3. Select Install Straightaway – the recommended facility options.

For all recent versions of Python, the recommended installation options include Pip and Lazy. Older versions might not include such additional features.

4. The future dialog will prompt you to select whether to Disable path duration limit. Choosing this choice will tolerate Python to ring road the 260-character MAX_PATH trammel. Effectively, it will enable Python to use long path name calling.

The Disable path duration terminal point option will not affect any other system settings. Turning it on will resolve potential name length issues that may arise with Python projects highly-developed in Linux.

Step 4: Swear Python Was Installed On Windows

  1. Navigate to the directory in which Python was installed happening the system. In our slip, IT is C:\Users\Username\AppData\Topical anaestheti\Programs\Python\Python37 since we own installed the latest version.
  2. Double-click python.exe.
  3. The output should be similar to what you can come across beneath:

Note: You can also check whether the installation was successful aside typewriting python –V in Command Prompt. The output should display your installed version of Python. In our case, information technology is "Python 3.7.3."

Step 5: Verify Pip Was Installed

If you opted to set up an elder interlingual rendition of Python, IT is affirmable that IT did not come with Pip preinstalled. Pip is a powerful package direction system for Python software packages. Thus, make sure that you have it installed.

We recommend using Pip for most Python packages, especially when working in virtual environments.

To verify whether Pip was installed:

  1. Open the Start menu and type "cmd."
  2. Select the Prompt application.
  3. Enter whip -V in the console. If Pip was installed successfully, you should see the following output:

Pip has not been installed yet if you get the following output:

          'hit' is not recognized every bit an intrinsic or external command, Operable program or batch file.        

If your version of Python is missing Pip, see our article How to Put in Pip to Manage Python Packages on Windows.

Step 6: Total Python Itinerary to Environment Variables (Facultative)

We recommend you go through with this step if your adaptation of the Python installer does not include the Add Python to Way checkbox or if you have not selected that option.

Setting dormy the Python path to system variables alleviates the postulate for using full paths. It instructs Windows to look finished all the Way of life folders for "Python" and find the install folder that contains the python.exe file.

1. Staring the Start carte du jour and first the Run app.

run dialog box

2. Type sysdm.cpl and click OK. This opens the Arrangement Properties window.

3. Navigate to the Advanced tab and select Environment Variables.

4. Below System Variables, find and select the Path variable.

5. Click Blue-pencil.

6. Select the Variable economic value field. Add the path to the python.exe file preceded with a semicolon (;). For example, in the figure of speech below, we have added ";C:\Python34."

How to add the Variable Value durring python3 windows installation.

7. Click OK and close all Windows.

Past mount this up, you can execute Python scripts like this: Python script.py

Instead of this: C:/Python34/Python script.py

As you can see, it is cleanser and more manageable.

Step 7: Install virtualnv (Optional)

You wealthy person Python, and you have Pip to negociate packages. Now, you need ane live software package - virtualnv. Virtualnv enables you to create isolated local virtual environments for your Python projects.

Why use virtualnv?

Python software packages are installed organization-wide by default. Accordingly, whenever a single project-specific computer software is changed, it changes for all your Python projects. You would want to avoid this, and having separate virtual environments for all project is the easiest answer.

To install virtualnv:

1. Open the Start menu and type "cmd."

2. Select the Command Motivate application.

3. Case the following pip command in the console:

          C:\Users\Username> pip install virtualenv        

Upon windup, virtualnv is installed on your system.

End

In that instructor, we detailed how to install Python 3.7.3 on Windows. If you are installing a different reading of Python, you can expect a similar process.

To promote Python to a newer adaptation, check our article how to acclivity Python to 3.9.

Remember, choose your version cautiously, draw sure that you have got Pip installed, and use virtual environments when developing threefold projects happening a singular system.

Want to prove impossible another new propagation, server-go with scripting languages? Check forbidden How to Install Ruby on Windows 10.

Happy coding!

Was this clause helpful?

Yes Nary

How Do I Run a Python Program in Windows 10

Source: https://phoenixnap.com/kb/how-to-install-python-3-windows

0 Response to "How Do I Run a Python Program in Windows 10"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel