Reputation: 479
I am relatively new to Python and to Ubuntu. I have had problems in the past handling multiple versions of Python on my computer so I wanted to install Anaconda to use a Python version in a separate environment.
However, I am having trouble understanding how Anaconda handles multiple Python versions. I apologize for the lengthily post but I am desperate to understand this. To give some context, here is what I did:
Step 1: checking for existing Python versions
I have a Ubuntu 18.04 freshly installed.
$ cd
$ ls -l /usr/bin/python*
# Output:
# 0 lrwxrwxrwx 1 root root 9 Oct 25 12:11 /usr/bin/python3 -> python3.6
# 4420 -rwxr-xr-x 2 root root 4522328 Oct 22 12:32 /usr/bin/python3.6
# 4420 -rwxr-xr-x 2 root root 4522328 Oct 22 12:32 /usr/bin/python3.6m
# 0 lrwxrwxrwx 1 root root 10 Oct 25 12:11 /usr/bin/python3m -> python3.6m
So far so good, I basically have 3.6 installed by default.
Step 2: installating Anaconda
I wanted to keep things simple so decided to download Anaconda that comes with Python 3.7 at this link: https://www.anaconda.com/download/#linux
I did so by following these exact instructions: http://docs.anaconda.com/anaconda/install/linux/
This included:
All this worked. I can launch Anaconda by typing "anaconda-navigator" in terminal and upon launching Spyder, I can see I have version 3.7
Step3: checking existing Python versions (again)
Here, I just wanted to understand where everything was stored.
$ cd
$ ls -l /usr/bin/python*
# Output
# lrwxrwxrwx 1 root root 9 Apr 16 2018 /usr/bin/python -> python2.7
# lrwxrwxrwx 1 root root 9 Apr 16 2018 /usr/bin/python2 -> python2.7
# -rwxr-xr-x 1 root root 3670448 Nov 12 14:31 /usr/bin/python2.7
# lrwxrwxrwx 1 root root 9 Oct 25 12:11 /usr/bin/python3 -> python3.6
# -rwxr-xr-x 2 root root 4522328 Oct 22 12:32 /usr/bin/python3.6
# -rwxr-xr-x 2 root root 4522328 Oct 22 12:32 /usr/bin/python3.6m
# lrwxrwxrwx 1 root root 10 Oct 25 12:11 /usr/bin/python3m -> python3.6m
This brings to my questions (which are all linked)
mono-runtime-sgen po-debconf python python-minimal python2.7 python2.7-minimal x11proto-composite-dev x11proto-core-dev m4-doc libmail-box-perl python-doc python-tk python2.7-doc python2.7 python2.7-minimal x11proto-composite-dev x11proto-core-dev Selecting previously unselected package python2.7-minimal. Preparing to unpack .../python2.7-minimal_2.7.15~rc1-1ubuntu0.1_amd64.deb ... Unpacking python2.7-minimal (2.7.15~rc1-1ubuntu0.1) ... Selecting previously unselected package python2.7. Preparing to unpack .../python2.7_2.7.15~rc1-1ubuntu0.1_amd64.deb ... Unpacking python2.7 (2.7.15~rc1-1ubuntu0.1) ... Setting up python2.7-minimal (2.7.15~rc1-1ubuntu0.1) ... Linking and byte-compiling packages for runtime python2.7... Setting up python2.7 (2.7.15~rc1-1ubuntu0.1) ...t
Where is 3.7? Is it in /home/anaconda3?
Why are the symbolic links in the output of "ls -l /usr/bin/python*" wrong? Indeed, when I open a terminal:
Am I missing something or is this all normal? Apologies for the long post. Many thanks.
Upvotes: 0
Views: 863
Reputation: 2412
Anaconda in installed in ~/anaconda2
or ~/anaconda3
by default except if you specified another directory. Normally, anaconda does not change anything in /usr/bin
but it adds /path/to/anaconda/bin
to your path (in ~/.bashrc
) (again, you have to specify this at installation). You can check using which -a python
to see what python executable are in your path, the first result being the one that will be executed when you call python
from command line.
NB: You can download anaconda installation script with python2.7 or 3.7 but only one version of python will be included by default. You can download two versions but make sure to only add one of them in your path if you do
For the symlinks, I cannot help you as I don't use Ubuntu. What I can tell you though is that my system links python
to python2.7
but maybe that Ubuntu changed this in its latest release.
Upvotes: 1