-1

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?

martineau
  • 119,623
  • 25
  • 170
  • 301
Scott Marcus
  • 64,069
  • 6
  • 49
  • 71
  • its going to depend on how python is installed. You may be able to simply open a command prompt and start typing "pytho.." and see what auto-completes. Maybe try `py myprogram.py` or even just `myprogram.py`. You may be able to click on the .py file. It all depends on what the python installer did. You may have luck over on superuser.com. We usuallly deal with the bugs _after_ you get python running. – tdelaney May 30 '21 at 17:48
  • Maybe plex installed its own python and its not in the environment for other programs. You could go to https://www.python.org/downloads/windows/ and install from there. – tdelaney May 30 '21 at 17:49

5 Answers5

1

Plex provides their own python libraries. This is built on Python 2.7. You do not need Python installed in order to run Plex and it's not recommended to use 2.7 at this point. You also cannot use the Python version provided by Plex, in the way you are hoping, as they don't include the executable.

Inside the installation directory of Plex you will see two files.

  • python27.dll
  • python27.zip

The contents of the zip folder are very close to the Lib folder from a standard installation of Python 2.7.

None of the provided solutions worked for you because python was not installed or available on your system path. Python can be installed by downloading it directly from Python (https://www.python.org/downloads/), executing the downloaded file, and following the prompts.

An alternative way to install Python is from the Microsoft Store, for Windows.

0

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
print(os.path.dirname(sys.executable))

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)

Aru
  • 352
  • 1
  • 11
  • I have no ide what the "terminal" is. As I say, I have an existing program that apparently relies on Python because I see Python running in Windows Task Manager. Beyond that, I know nothing about it. – Scott Marcus May 30 '21 at 17:49
  • The terminal is system dependant not programming language dependant. if you are using windows, then press windows button and type ```cmd``` and hit enter to open it. As far as i know u can even type ```terminal``` and hit enter too . An alternative would be the windows powershell. – Aru May 30 '21 at 17:53
  • Oh, you just mean a Command Prompt. That I know. – Scott Marcus May 30 '21 at 17:56
  • yes, in linux and macos its called terminal, for windows most say command prompt (cmd). here you can see how to open it. https://www.ionos.com/help/email/troubleshooting-mail-basicmail-business/access-the-command-prompt-or-terminal/#:~:text=Open%20Command%20Prompt%20in%20Windows,cmd%22%20and%20then%20click%20OK. – Aru May 30 '21 at 17:59
  • Yes, ok. Thanks. I've been using command prompts since DOS. It's just that the term "terminal" was used and that's not the term for it in Windows so I assumed Python had its own interface called the terminal. – Scott Marcus May 30 '21 at 18:01
  • Alright. my bad. Then you should be familiar with the syntax i wrote (because WindowsPowershell syntax might differ a bit) // you can run python it self in your command prompt by typing python, and type exit() to close python. if my answer helped to solve your questions please mark it as accepted.(green check) – Aru May 30 '21 at 18:03
  • Thanks, but your answer wasn't "the" answer and really just threw me off because of the terminology. I've added my own answer as it turns out Python didn't have a normal install in the program that I use and I had to download and install it. – Scott Marcus May 30 '21 at 18:30
0

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 :)

0

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.

C:\WINDOWS\system32>python
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>

Chandella07
  • 2,089
  • 14
  • 22
-2

None of the suggestions for finding where Python was installed worked.

As @tdelaney mentioned in the comments, 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.

Scott Marcus
  • 64,069
  • 6
  • 49
  • 71
  • @martineau I've been on SO for 10 years and have a rep of over 50k. I know when a comment is a comment and an answer is an answer. This is the answer to my question, which I figured out myself based on tdelaney's comment. – Scott Marcus May 30 '21 at 18:48
  • Sorry about that, it didn't sound like one to me. BTW I know full well how to determine someone's rep and how long they've been on SO. – martineau May 30 '21 at 18:53
  • @Aru As my answer states, I didn't have the standard installation of Python installed, so yes, I had it installed, but no, none of your suggestions were possible. So, I don't know why you think that your answer was "the" answer for me. – Scott Marcus May 30 '21 at 19:40
  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/29089634) – Kishan Mehta May 31 '21 at 10:45
  • @KishanMehta I think I know what the answer to my own question was. – Scott Marcus May 31 '21 at 20:02