Skip to main content

How to add Python to Path (Windows)

Keyboard Typing Coding

One of the great things about having Python installed on your Windows machine, is that you can access it from anywhere. Simply pull up a command prompt and you can start entering commands, installing new modules via pip, and feeling like a badass hacker!

In order for this to work though, you need to know how to add Python to PATH. PATH is an environment variable. This is what tells the command line which folders it needs to look in when searching for the file. If Python isn’t added to PATH, then you would need to point CMD directly to the Python.exe and then run the executable file:

C:\PythonX\python.exe

But once you know how to add Python to PATH, you can simply type “py” and start running! Likewise, with Python added to PATH, you’ll be able to run Python files as simply as:

C:\py PythonApplication.py

How to add Python to PATH

Before you read any further, it’s first worth checking whether Python is already available.

An easy way to do this is to simply type “py” or “python” at the command prompt. If Python is available, you’ll see the version number that’s installed on your machine and you’ll then be able to start using statements like “print.”

Good news, you can skip the next part of this post!

If you see:

'python' is not recognized as an internal or external command, operable program or batch file.

Then we have work to do!

Also read: How to print in Python

So how do you add Python to your path? The easiest option is to handle this while installing the Python interpreter. As you install Python, simply be sure to tick the box that says “Add Python to PATH.”

This can be found at the bottom of the image and it may be unticked by default!

How to add Python manually

If you already have Python installed, then installing a fresh version might not be an option. One option would be to uninstall and reinstall Python, or to simply update your current version.

Another option is to update your version of Python in order to go through the process again.

Also read: How to run a Python script in the terminal

Alternatively, you might learn how to add Python to PATH manually. Do this by right-clicking on “This PC” in explorer. Then click “Advanced system settings.”

How to add Python to PATH

Credit: Adam Sinicki/ Android Authority

Now, under the tab that says “Advanced,” choose “Environment Variables…”

Click “New” and then enter “Path” where it says “Variable Name.”

Where it says “Variable Value,” you’re going to copy and paste the full path of your Python application.

And there you go: that’s how you add Python to PATH!

Also read: How to run a Python script in the terminal or CMD


Now that Python is up and running on your machine, you may want to take your learning to the next level! We’ve compiled a list of the very best online course for learning Python, including a number of huge deals. Check that out here:



source https://www.androidauthority.com/how-to-add-python-to-path-1140374/

Comments

Popular posts from this blog

LIVE Day Trading Morning Show for Tuesday!

LIVE Day Trading Morning Show for Tuesday! via YouTube https://www.youtube.com/watch?v=vgagRBXRJM0 Android Tips and Tricks working hard to get the latest and useful tips and techniques that help you to solve a problem or improve your productivity.

How to unhide or show folders in mx player list

In this blog post, I tell you about how to Show or Hide folders from MX player list. There are two methods to Show folder from MX Player list. Method 1: Unhide / show folders If you want to temporarily Show / Unhide hidden folder from MX Player list, then go to Settings and untick Recognize .nomedia ".  Method 2: Permanently unhide / show folder: Open memory by any file explorer and I recommend X-Plore, and open the folder that is Hidden and find the file " .nomedia ". If you didn't find it, you should first enable "Show files hidden files that starts with .(dot)". Delete the file and you just need to refresh MX Player list to take changes. Note: MX Player always hide those folders which file " .nomedia " exists.

How to use AWS – a simple guide for beginners

Amazon Web Services (AWS) is Amazon’s powerful, market-leading solution for cloud computing. The platform offers a suite of products for businesses: security, cloud backup, machine learning, IoT solutions, and more. In this post, we will explore how to use AWS. What you need to know Many entrepreneurs and small businesses may assume that AWS is not for them. Perhaps the pricing will be too prohibitive, or it will require too much technical know-how. While both of these issues certainly do crop up from time-to-time, the truth is that Amazon’s offerings are extremely wide-reaching and include options at many different price points and levels of complexity. That is to say, that while some products might be off-limits, others are not. Some AWS products are completely free and very simple to get to grips with! See also: AWS vs Azure vs Google Cloud – Which certification is best for professionals? AWS includes over 175 different products, some of which don’t even require an AWS accou...