Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8530201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:12:20+00:00 2026-06-11T09:12:20+00:00

I have two versions of python installed on my computer. 3.2 64 bit installed

  • 0

I have two versions of python installed on my computer. 3.2 64 bit installed in C:\Python32\ and 2.7 32 bit installed in C:\Python27.

I also have a C# application digging in the registry (64 and 32 bit) to get the install path of the most appropriate python version to use depending on various conditions.

I have a script called Code.py, which is run by the C# application using the python version it selected.

In the Code.py script, I want to run another script located in either C:\Python32\Scripts or C:\Python27\Scripts, depending on which python version was used. However, I want to know what is the install path of that python.exe file used to run the script I am currently in. Is there a way to do that or I’ll have to communicate the install path selected by the C# application as an argument when I run the script (which I would want to avoid)?

Edit: I call the script inside my script as an external script using this code

p = subprocess.Popen(["python", installPath + "\\Scripts\\Flake8", file], stdout=subprocess.PIPE)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:12:21+00:00Added an answer on June 11, 2026 at 9:12 am

    Use sys.executable.

    >>> import sys
    >>> sys.executable
    '/usr/bin/python'
    

    os.path.split() removes the last component for you if all you need is the path:

    >>> import os.path
    >>> os.path.split(sys.executable)
    ('/usr/bin', 'python')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two versions of python installed on my mac running OSX Lion. The
I have two versions of python installed on Win7. (Python 2.5 and Python 2.7).
I am working on a RHEL system. I have two versions of Python installed
I have installed two different python versions (3.1 and 2,7) And this is now
I have written a Python module, and I have two versions: a pure Python
I have two versions of a Windows Forms Application and can't figure for the
I have to use Python and Django for our application. So, I have two
I have two python versions: Python 2.5 and Python 2.7. When I'm setting up
I have two versions of python on my mac: One preinstalled by Apple in
I have two python versions on my server namely 2.4 and 2.7. It is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.