GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - W-Sebastian/PythonInstallFinder: A simple batch script to find the location of specific versions of python for Windows OS.

BranchesTags
Open more actions menu

Latest commit

 

History

8 Commits
8 Commits

Folders and files

NameName
Last commit message
Last commit date
LICENSE
LICENSE
 
 
README.md
README.md
 
 
find_python.bat
find_python.bat
 
 

Repository files navigation

Python Installation Finder

A bat script to look for a specific version of python and get its directory. It it intended to be used on applications or installers that rely on python to do their work.

Usage

To get the location of python 3.6:

find_python.bat -pv 3.6

To get the location of python 3.6, 3.5, 3.4 or 3.3:

find_python.bat -pv 3.6 3.5 3.4 3.3

Both these runs show no output so it can be easily integrated in other scripts. The location of the python directory can be found in the environment variable PYTHON_INSTALL_DIR. From batch, python can be invoked using %PYTHON_INSTALL_DIR%\python.exe.

If the path is preferred to be taken from the output, then the -p extra option can be used:

find_python.bat -pv 3.5 -p

If this command runs then the output will either be "Python installation not found" or the actual location of python executable for 3.5.

When providing multiple versions the order is important because the check is done from the first to the last, first for 64 bit then for 32 bit. So if the above example the script tries to find the installation for python 3.6 on 64 bit, then for 3.6 on 32 bit, then moves to 3.5 64 bit and so on. As soon as one is found the script ends.

How it works

When called it first looks in the $PATH$ variable for python.exe. If it is found then it asks for its versions and check if it matches any of the provided versions returning that path.

If this didn't worked it looks into registry and tried to find an entry for a python installation matching the provided versions. If that is found it simply returns that path with no further extra checks. There is a chance that the registry are still there while the user might had deleted the local files; this is not covered in the script.

Limitations

  • The versions must be of the form Major.Minor. No other version format is supported;
  • It always looks for both 32 and 64 bit versions. There is currently no way to disable or force to look for one although this should be fairly trivial to support;
  • If python is found on the path it no longer checks if the version is 32 or 64 bit.

About

A simple batch script to find the location of specific versions of python for Windows OS.

Topics

batch-scriptpython-installationwindows

Resources

Readme
MIT license
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.