Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

I have a Debian system currently running with python 2.5.4. I got virtualenv properly installed, everything is working fine. Is there a possibility that I can use a virtualenv with a different version of Python?

I compiled Python 2.6.2 and would like to use it with some virtualenv. Is it enough to overwrite the binary file? Or do I have to change something in respect to the libraries?

1 Answer

0 votes
by (106k points)

It can be done just by using the --python. When you are creating your virtualenv instance to specify the Python executable file you should use the following command:-

 e.g:-

virtualenv --python=/usr/bin/python2.6 <path/to/new/virtualenv/>

For Python 3.6 you can use the following command  for creating the virtual environment:

python3 -m venv <myenvname>

For the python version (3.3+), use either the above method or the script pyvenv the command is as follows:-

pyvenv /path/to/new/virtual/environment

Related questions

0 votes
1 answer
asked Nov 21, 2020 in Python by laddulakshana (16.4k points)
0 votes
1 answer
0 votes
1 answer
asked Sep 25, 2019 in Python by Sammy (47.6k points)
0 votes
1 answer

31k questions

32.4k answers

500 comments

693 users

Browse Categories

...