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

4 Surprising Ways Artificial Intelligence will Empower Consumers

Ever wonder what makes Siri search the items inside the iPhone and on the web by recognizing your voice? How does Google listening work? Artificial Intelligence and data science have already infused in this consumer-oriented generation, but we have not realized it yet. It has been quite a while that natural language processing, speech recognition, and gesture recognition system took over the market with their all new features, but what are the new things in AI that are yet to come? Few amazing transformations are: Retailing sector to become AI-ready Voice Recognition will change the game Search engines to become smarter Machine learning to bring revolutionary changes Recently we got to learn about a verbal spat between Elon Musk and Mark Zuckerberg over the probable risk and opportunities brought by AI . Believe it or not, but we already accustomed to Artificial Intelligence and probably waiting to witness jaw-dropping inventions. Some of AI inventions we have known till yet are: Mach

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 arrays in Python

Arrays in Python give you a huge amount of flexibility for storing, organizing, and accessing data. This is crucial, not least because of Python’s popularity for use in data science. But what precisely is an array? And how do you use arrays in Python? Also read: How to use dictionaries in Python Read on, and we’ll shed some light on the matter. What is an array? An array is a way to store multiple values in a single variable. That means that you can use a single “reference” in order to access your data. A list is also an example of a variable that stores multiple values, but has some slight differences. When using lists in Python, you store a series of values each with a numbered index. For example, this is how you would create a list of fruits in Python: fruits = [“apple”, “orange”, “pear”, “nectarine”] If we then say: print(fruits[3]) We will see “nectarine” appear on the screen (the first entry is stored as “0”). Also read: How to use lists in Python This is not an