Recommand · May 30, 2021 0

How to use an already installed Python?

I have Plex installed on my PC, which relies on Python to run. I know nothing about Python, but I can see that it is running in Windows Task Manager. Now, I’ve got some other unrelated Python scripts that I need to run, but I have no idea how to find where Python is located on my system or how to access it.

According to How can I find where Python is installed on Windows?, I’m supposed to go to my Python interpreter to find out, but I have no idea what or where that is.

This is completely new to me. Could someone hold my hand and walk me through how I can run .py files?

I will assume you are running on windows,so all you have to do is go to the Window’s search option and search Python and you will there is python and then you just have to click it and click on open file location and then you will find the folder of it and your desired python version will be there.Then you just have to left click to go to the properties of it and click on open file location and you will find where you’r python is located and i will assume your python is most likely in the AppData\Local\Programes\Python folder 🙂

In windows: open the command prompt and type python, if it is set in your environment variables (which it asks while installation) it will open the python interpreter.

Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 22:39:24) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

for checking other files and modules, try on interpreter below.

>>> import sys
>>> print(sys.path)

To execute a python file. Simply open the command prompt and go to the location of the file and type python <name_of_python_file>

Python should be located at C:\Program Files\Python Are you trying to run py files through Command Prompt (CMD) or WindowsPowershell ? If yes then you can move to the directory, where your py files are located and just type the name of the py file in your terminal, to run it.

If you still cant find the directory, you can use a python interpreter and write:

(you can also open python in CMD by typing python then write the code below line by line,hitting enter after each line)

import os
import sys

In Command Prompt(CMD) use cd path_name(f.example desktop) to move in directory, and cd .. to move back. Then you can us dir to see a list of the files in that directory , and simply type the name of your file for example python_file and hit enter to run it.

(Syntax might differ in WindowsPowershell)

@tdelaney Apparently that is the case because none of the suggestions on how to find it resulted in anything. So, even though Plex uses Python and it’s running in my system, I don’t actually have a standard install of it. I had to go download it.