1

I currently have both the native python3 and anaconda installed on my computer. This is causing headaches when iI'm installing modules.

When I enter which -a python3 I get:

/home/paul/anaconda3/bin/python3
/usr/bin/python3

I've got a couple of questions.

How do i know which one is being used as default when I type python3?

I'm assuming the anaconda version because when I try which python3 I get the anaconda version. However when I install modules they aren't always visible from this version. How would I best solve this permanently?

The most recent problem module is kivy using apt-get to install.

gudok
  • 4,029
  • 2
  • 20
  • 30
Paul Clarke
  • 328
  • 2
  • 13
  • Possible duplicate of [How to check if a program exists from a Bash script?](https://stackoverflow.com/q/592620/608639), ['which' vs 'command -v' in Bash](https://stackoverflow.com/q/37056192/608639),[“Proper way” to manage multiple versions of Python](https://stackoverflow.com/q/7297094/608639), [Multiple Python versions on the same machine?](https://stackoverflow.com/q/2547554/608639), etc. – jww Mar 11 '19 at 09:55

4 Answers4

0

The best way to install python packages is using pip and change the path of the interpreter:

# Default python:
> python -m pip install kivy

# Virtualenv python:
> path/to/python -m pip install kivy

More answers here

As @Andrejs said, depending on your distro you may have to change pip to pip3 depending on your python version.

Pau
  • 536
  • 5
  • 16
  • 1
    Two cents from my side: on debian based systems (incl. Ubuntu) there are two different `pip` packages, one per Python flavor: `python-pip` for Python 2, `python3-pip` for Python 3. Accordingly, they will install `pip` and `pip3` tools. – Andrejs Cainikovs Mar 11 '19 at 12:54
0

Python usually has no problems with 2.x and 3.x coexisting , they have their own separate pip called appropriately and they don't interfere with each other.

You can symlink your python to which version you need like this.

   $ ln -s /bin/python3 /usr/bin/python3.4

You can use pip for all packages management or use apt when it is available in Ubuntu repo.

0

I've already handled a similar question here: https://stackoverflow.com/a/53413268/7933710

TLDR; you can use the update-alternatives command to select which version is used by default.

update-alternatives --config python

This will start an interactive menu to choose a version. If you're missing a version install by:

update-alternatives --install python /usr/bin/python3.4 2

the 2 at the end is a priority level.

Borisu
  • 828
  • 7
  • 15
0

I recommend you uninstall everything and reinstall Anaconda adding it to the environment variables during installation.

Once done, you should install libraries via Anaconda.org instead of using pip. This way your libraries will be a lot better organised and everything will be a lot easier to update when required.

Alternatively if you need to keep both versions but make sure that there is only one version on your environment tables.

W Barreto
  • 438
  • 4
  • 11