Where Is Python Installed On Windows?(Explained)

Where Is Python Installed On Windows? (Explained)

If you went outside and saw a python in your path, that would not be good. But we’re talking about whether Python is in the Windows PATH, a list of places where Windows looks for software.

At the command prompt, enter Python. Python should start if it is in your PATH:

• Proceed to the next section if you saw Python startup; if you got an error message instead, you could add Python to your PATH by following the steps below.

• Enter python.exe into the Windows search bar, but do not select it from the menu, right-click on it and select “Open file location.”

• A window with some files and folders will appear. Python should be installed here. Right-click the address bar at the top and select “Copy address as text.”

• Keep in mind that if the address bar says “Start menu,” you’re probably looking at a Python shortcut.

Right-click on the file called Python 3.x (where 3.x is the version number of your Python installation) and select Open file location until you see a folder with a file called python.exe in it.

Select Control Panel from the main Windows menu:

• In the top right search box, type “environment” and click “Edit environment variables for your account” in the results list.

• If a variable named Path is already listed, select it by clicking on it, then click Edit, if it does not exist, click New instead.

• If your pop-up window looks like the one below, click “New” and paste the address you just copied. Then click New, paste the address again, and add Scripts at the end. To finish editing your environment variables, click OK twice.

• If your pop-up box only has one line for the variable value, type a semicolon (;), then paste the address again and add Scripts at the end. To finish making changes to the environment variables, click OK.

• If the command prompt window is still open, close it and reopen it; this ensures that the changes you made at the command prompt have taken effect.

• At the command prompt, type python again and press the Enter key. Python should now be available for use. Ctrl+c will exit the Python shell.

How to Determine the Windows Path Where Python is Installed?

Python is usually installed on Windows in one of two locations:

• C: Python39

• C:UsersYourUserAppDataLocalProgramsPythonPython39

This article explains how to check if it is different for you because I’d go with the second option.

Before you start, consider the following:

• Do you have a Python interpreter or shell available?

• Do you have access to a command line or PowerShell?

• Do you have both?

Where Is Python Installed On Windows? (Explained)
Where Is Python Installed On Windows? (Explained)

Have you got access to a Python shell?

Run the following two lines in your shell to get the installation path in a readable format.

Python shell:

1. Use the following command to import the os and sys libraries: 

Import os, sys

2. Use the following command to print the path to the shell: print(os.path.dirname(sys. executable))

The following piece of code shows this:

import os, sys

print(os.path.dirname(sys.executable))

The computer displays the following installation path:

‘C:\Users\xcent\AppData\Local\Programs\Python\Python39’

You can copy it to the clipboard and use it wherever you want.

There is a shorter way, but the output is not as good, using double front-slash path delimiters:

import sys

print (sys. executable)

On the computer, you can see the output in a Python shell:

import sys

print(sys.executable)

‘C:\\Users\\xcent\\AppData\\Local\\Programs\\Python\\Python39\\pythonw.exe’

Do you have access to a command line or Powershell?

For Windows, you can get the Python installation path by putting the Python code into a short, easy-to-copy one-liner command:

Python -c “import os and sys; print(os.path.dirname(sys.executable))”

If Python is permanently installed, you can run the python command in PowerShell from any directory, which is very useful.

You can also use the simple two-word command “where Python” in the Windows command line to determine where Python is installed. On a Windows computer, it works like this:

Where does Python appear?

This lets the following results:

C:\Users\xcent\AppData\Local\Microsoft\WindowsApps\python.exe

Next, you’ll discover a method for determining where Python is installed even if you don’t have access to the Python interpreter or the Windows command line.

Get Python’s Installation Path Without Using a Shell

If you don’t want to use the Python interpreter or the command line to find out where Python is installed on Windows, you can check in the Windows registry, which has a key for each installed Python version. Both of these variants are feasible:

• HKLMSOFTWAREPythonPythonCoreversionnumber

InstallPath

• HKCUSOFTWAREPythonPythonCoreversionnumber

InstallPath

If you have a 64-bit version of Windows, look under the Wow6432Node key for the Python path:

• HKLMSOFTWAREWow6432NodePythonPythonCoreversionnumberInstallPath

This post explains how to use these various variants in your code. For example, a more in-depth discussion can be found on the official Python wiki.

Python’s Default installs Location.

1.

This guide demonstrates how to install Python on a Windows computer.

The Python installer asks if the installation directory should be changed like any other directory. For example, the user can tell the installer where to install Python if it does.

Python can usually be installed in one of the following directories:

• C:UsersAppData

• C:PythonXY

• C:Program Files

This article will concentrate on these directories and the directories for installing Python in all three of them.

Install Python On the User’s AppData Directory

This means that you do not need to be an administrator to install the software. All you have to do is decide where you want to install it.

The issue with installing software in this directory is that it can only be accessed and used by one user. However, other users may be required to reinstall the software for another user.

Python is installed in the C:Program Files directory.

Python can be installed in the Program Files directory, the default location for all other Windows programs. It is an excellent option for those who want to install Python for more than one user simultaneously.

It does, however, have some drawbacks because of the new security features that have been added to newer versions of Windows. For example, the permissions for the Program Files subfolder are restricted, which may prevent some packages from installing or being used.

Installing Python in the C:\Program Files Directory

Installing Python in the directory’s root makes it easier to remember and type on the command line. It is similar to the directory mentioned above in that all users, not just the person who installed Python, can use the installed software.

One major issue with installing Python in the root directory is that it makes the computer less secure. Anyone with access to the user can easily find and use the root directory, making it less secure. You must also be an administrator to install Python in this directory.

How to Determine Where Python is Installed on Windows

This section of the guide will show you two ways to find out where Python is installed on Windows:

• Using the sys library

• Manually

Using the Sys Library, you can find where Python is installed on Windows.

The sys library can find you where Python is installed:

Import sys

locate python = sys.exec prefix

print(locate Python)

Here’s an example of a possible path structure:

C:\Users\Ron\AppData\Local\Programs\Python\Python39

Manually locate Python’s installation location.

You can also manually find out where Python is installed by following these steps:

In Windows, enter “Python” into the search box.

Right-click the Python App and select “Open file location.”

Right-click the Python shortcut and select Properties.

Click “Open File Location.”

You will now find where Python is installed on Windows:

C:\Users\Ron\AppData\Local\Programs\Python\Python39

Notice how the path in this method is the same as the path in the first method.

Once you have the above path, you will be able to do things like upgrade pip.

Conclusion

Hope this post helps you and if you have questions about anything concerning this topic, please leave them in the comment section below. Please use the social buttons to share this post with others. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners. View more
Cookies settings
Accept
Privacy & Cookie policy
Privacy & Cookies policy
Cookie nameActive

 Our website address is https://easytechguide.com.

Comments

 When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection. An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.

Media

 If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.

Cookies

 If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year. If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser. When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select "Remember Me", your login will persist for two weeks. If you log out of your account, the login cookies will be removed. If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.

Embedded content from other websites

 Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website. These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.

Who we share your data with

 If you request a password reset, your IP address will be included in the reset email.

How long do we retain your data?

 If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue. For users that register on our website (if any), we also store the personal information they provide in their user profiles. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.

What rights do you have over your data?

 If you have an account on this site or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.

Where we send your data

Visitor comments may be checked through an automated spam detection service.

Contact Us

If you have any questions about these Terms and Conditions, You can contact us:
  • By email: Info@easytechguide.com
 
Save settings
Cookies settings