6

I have both python versions installed on my linux:

[/usr/bin] ls -la | grep python

python -> python3
python-config -> python3-config
python2
python3
python2-config
python3-config

I need to launch program which use a python to do some work. I cannot change this program and I don't know how it works, but I want it use python2.

As I see I can do it if I change python and python-config links. Is there any better way to do it ?

I have not found how to use different versions of python with virtualenv. May be there is something like rvm in ruby ?

1

1 Answer 1

5

You can use specific version of Python with virtualenv like this -

virtualenv -p /usr/bin/python2 <path/to/new/virtualenv/>

This way the virtualenv would use Python 2.x version installed on your system.

PS: DON'T alter the symlinks between Python 2 and 3 manually. Might break your system.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.