Issue
I use debian and I have python 3.5.3 installed. I am going to work on a project which requires python 3.6, but the last time I installed python 3.6 on my computer it broke a lot of things, so I would like to avoid that. What I want is to create a virtual environment which runs python 3.6, but without affecting my python 3.5 installation.
I know that the virtualenv command has an option to specify which python to use, but this would only work if I have a python 3.6 executable on my computer. Is there a way to install the virtualenv without having the python 3.6 executable installed ? If not, is it possible to install python 3.6 without getting rid of python 3.5 ?
In case you're wondering, this is the procedure I followed to install python 3.6, which broke a bunch of stuff. Since then I've re-installed my OS for other reasons, and now I'm back on python 3.5.
Solution
I'm interested in knowing how else to do this. But I personally use conda
.
You can create other Python environments without having to installing it first because it's included in the anaconda
metapackage.
If you look at my default system you see that it's only Python 2 available.
$ cd /usr/bin/ | ls | grep python
-rwxr-xr-x 1 root root 11224 Sep 1 2016 abrt-action-analyze-python
-rwxr-xr-x 1 root root 7136 May 3 2017 python2.7
lrwxrwxrwx 1 root root 9 Dec 9 13:27 python2 -> python2.7
lrwxrwxrwx 1 root root 7 Dec 9 13:27 python -> python2
If you have conda installed then you can use the below to create a venv, activate it, and then you see you're using a different Python that's not installed on your file system.
conda create -n py35 python=3.5 anaconda
$ source activate py35
py35 $ python --version
Python 3.5.3 :: Anaconda 4.4.0 (64-bit)
Answered By - Orenshi Answer Checked By - Marie Seifert (WPSolving Admin)