简体   繁体   中英

Python Installation: What is file path to python.exe?

I am trying to schedule my python code (.py) to run in Windows 10 using task scheduler. In order to do so, I need to indicate where my python.exe file is located.

I downloaded the latest Anaconda to my Windows 10 machine and run my code in jupyter notebook successfully so I should have python.exe somewhere.

I cannot find where the "python.exe" file path is stored in my computer. Thoughts?

Please see sample example below:

在此处输入图片说明

You can get it quite easily using the os module:

First open a Python interpreter, not through terminal but directly (there should be a shortcut on your start menu).

Next get the os module:

import os

And use the getcwd() method to find it:

os.getcwd()

The better way to do it. If Python is added to path.

Open a command prompt window. Not the Python interpreter or open Power Shell and type:

where python

Another way to do it is to type python.exe in the file explorer search bar at C: .

Get yourself a copy of Search Everything and type python.exe into its search box. That will find all Pythons available on your PC.

截屏

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM