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

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 a web API from your Android app

Credit: Adam Sinicki / Android Authority A Web API is an online “application programming interface” that allows developers to interact with external services. These are the commands that the developer of the service has determined will be used to access certain features of their program. It is referred to as an interface because a good API should have commands that make it intuitive to interact with. An example of this might be if we want to get information about a user from their social media account. That social media platform would likely have a web API for developers to use in order to request that data. Other commonly used APIs handle things like advertising ( AdMob ), machine learning ( ML Kit ), and cloud storage. It’s easy to see how interacting with these types of services could extend the functionality of an app. In fact, the vast majority of successful apps on the Play Store will use at least one web API! In this post, we’ll explore how to use a web API from withi...

How to Hide and Show Videos in MX Player

We use android apps to hide our personal data from gallery or any viewing source. These Applications use mobile memory and use a lot of RAM and these type of Applications is major cause of battery power wastage. Now I will tell you about a tip  to hide videos from MX Player list without using Android Application. Step 1: Put all those videos which you want to hide in a folder. Step 2: Create an blank file and name it as ".nomedia " and  place this file inside the folder  where are targeted hidden videos are present. Step 3: Now check MX Player and the videos and those videos which you put on that folder would have been ignored (hidden) Refresh MX Player list if these showed again. To show hidden Videos just remove the " .nomedia " file. Note: No need to hide the folder and there is no need of any application.  MX Player hide the videos where the file " .nomedia " exists.