user330612
user330612

Reputation: 2239

tox can't detect python interpreter in D:\python27 path

My tox.ini file looks like this

[tox]
envlist=py27

[testenv]
deps=
    pytest

This fails to find my base python installation which is at D:\python27 and not the standard c:\python27 location

If I change tox.ini to this, it works but looks ugly.

[tox]
envlist=cpy27,dpy27
skip_missing_interpreters=True
toxworkdir={toxinidir}/build/tox

[testenv]
basepython=
    cpy27: C:\Python27\python.exe
    dpy27: D:\Python27\python.exe

deps=
    pytest

so my question, how can I configure tox so it can figure out where python is installed on the windows machine, w/o explicitly specifying the paths as each developer may have it installed it in a different path on their machine.

Upvotes: 6

Views: 4800

Answers (3)

André Sassi
André Sassi

Reputation: 1086

You can use the tox plugin tox-globinterpreter to specify the paths where you have installed interpreters on your machine without having to change tox.ini, which is especially useful if your code is shared with other people.

Just install this plugin with pip and configure the paths using tox --scan (use forward slashes):

pip install tox_globinterpreter
tox --scan D:/Python*/python.exe

Afterwards, tox will be able to find your Python installation.

Upvotes: 0

drmaa
drmaa

Reputation: 3684

After a couple of days I figure out how to setup the windows 10 without changing tox.ini, Follow the steps to get python2 and python3 setup in windows 10.

Make sure you installed python 2.7.16 which comes with its own pip. Install python 3 any version you want. Also make sure that you select custom installation and select available for all users checkbox during installation.

Now if you have python 2.7 in C:/python27 and python 3 in C:/program files/python36 then the following should be your system path environment variables. Remember the order is important.

enter image description here

Following files should be in your python27 directory.

enter image description here

Following files should be in Scripts of python27

enter image description here

Following files should be in python36 directory, duplicate python.exe

enter image description here

Following files should be in python36 scripts directory

enter image description here

After all the above setups, you should get all in path like below

enter image description here

Upvotes: 0

user330612
user330612

Reputation: 2239

I figured this out. looks like I need to specify python2.7 instead of py27 for windows

[tox]
envlist=python2.7

This correctly detects the location of python irrespective of C or D drive.

Upvotes: 8

Related Questions