Sublime Forum

How to find which version of two installed Python versions Build is using?

#1

I have two Python versions on my system Python 3.10 (32 bit) and Python 3.9 (64 bit).

When I use pip to install, say numpy, from the Windows cmd box, I get a ‘module not found’ error when I try to build the script. I think Build is using the 32-bit because successful builds are 32-bit, which is what I want but it seems pip is installing new modules in the 64-bit Python. I can run them from IDLE but they won’t build in Sublime.

I’m not sure how to get pip to install modules to the 3.10 32-bit Python rather than the 3.9 64-bit Python.

Any help would be very much appreciated!

0 Likes

#2

Build system runs py on Windows OS. So running py --version in console would print used interpreter.

0 Likes

#3

Thanks for your reply. When I type py --version I get

Python 3.10.7

But when I run python I get:

C:\Users\Philip>python
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:34:50) [MSC v.1934 32 bit (Intel)] on win32

I am confused! It may be because I have pyenv installed? Typing pyenv whence python I get:

3.11.3
3.11.3-win32

0 Likes

#4

When calling python the first matching interpreter which is found on %PATH% is used, most likely the most recently installed one.

Python launcher (py) starts whatever default python version was specified for it. It allows to call different python interpreters without actually knowing their installation path. This enables quickly switching between python versions.

The version to use can be specified via

  1. command line (e.g.: py -3.10-32 runs python 3.10 32bit)

  2. environment variable set PY_PYTHON=3.10-32

  3. ini file (C:\Windows\py.ini)

    [defaults]
    python=3.10-32
    

For more information see also: https://stackoverflow.com/questions/5087831/how-should-i-set-default-python-version-in-windows

2 Likes

#5

Thank you so much for explaining this for me! I was able to install the modules to the correct Python using:

py -m pip install numpy
etc.

scipy wouldn’t install as it gave an error but that’s another story!

0 Likes