0
votes

I used Anaconda for python.

python2 is installed in D:\Python\Anaconda2

python3 is installed in D:\Python\Anaconda3

python3 is the default.

created two environmental variables with name: python2 and python2 and selected respective python.exe from different folder respectively.

my setup.py supports only python2.

when i run command from cmd python setup.py install it says it does not support. If I rename D:\Python\Anaconda2\python.exe to D:\Python\Anaconda2\python2.exe and change the environment path file accordingly it works. But I dnt want to change the file name (as it may break other apps, like conda says unable to create process, etc).

Windows 10 Pro, 64 bit. setup.py location: E:\Program Files\IBM\ILOG\CPLEX_Studio1251\cplex\python\x64_win64

  1. How to overcome this? Want python2 setup.py install for python2 compiler and python3 setup.py install for python3 compiler, without renaming.

  2. How to install setup.py by running D:\Python\Anaconda2\python.exe?

2
Renaming python.exe is a bad idea, but you can create a symbolic link using an administrator command prompt, e.g. mklink python2.exe python.exe. Do the same for Python 3, and add both directories to PATH, with the preferred python.exe directory listed first. - Eryk Sun
Yes, that's a horrible idea.When I tried to add it to env var, it's taking as python.exe only - Dr.PB
Yes, that's a horrible idea. What to change in env path/ var? - Dr.PB

2 Answers

1
votes

I'm not sure whether this directly answers your question,but anaconda manages environments for you. Reference

You should be able to type into your Anaconda prompt to create your environment:

conda create --name pyenv python=2.7

and then list your environments:

conda info --envs

and lastly activate your environment python 2 or python 3 environments:

activate pyenv

These separate environments with their own versions of python are saved in the anaconda folder under the envs folder

/Anaconda3/envs/pyenv/python

0
votes

Here is how you can use both python2 and python3 in windows 10

Enter windows keys and type "Edit the system environment variables"

  • Click on Path and enter Edit button. enter image description here
  • Add path to both version of python. (Important) Here i have listed python3 and python2 in order because i want to see version 2 by python --version and version3 by python3 --version. enter image description here
  • Go to C:\python310 in windows (or whatever the name is for python3) and update executable file to python3 instead of python. enter image description here

Save and exit.

Now,

  • python --version // python 2
  • python3 --version // python 3

If you want it otherwise, update executable file of python2 to python2 instead of python. And update PATH variables to list python2 and python3 in order.