0

I have been learning machine learning and neural networks for some time. Therefore I have both 2.7.11 and 3.5.2 versions of python on my Ubuntu 16.04 installed with the purpose of learning Tensorflow. I sometimes may use python interchangeably, can I continue using both of them, or there are some constraints?

4
  • Not sure what you mean, the are the default on 16.04. Do you mean to ask if it is allright to keep it that way? Feb 21, 2017 at 15:07
  • It is very unwise to change the versions of python2 and python3 included with your install of Ubuntu. Essential system services depend upon them. This site is littered with many 'help! I broke my system by changing Python!' pleas.
    – user535733
    Feb 21, 2017 at 15:08
  • 1
    Use python to invoke Python2, and python3 to invoke Python3. Do NOT create a symlink that points python at python3! If you need different versions of Python than the defaults, use Anaconda and create some environments.
    – Carl H
    Feb 21, 2017 at 15:20
  • The code to install are sudo apt install python3-pip and sudo apt install python-pip so unless you have messed up your python install they should install without a fuss... Feb 21, 2017 at 15:59

1 Answer 1

2

This is fine, and completely normal. Python 2.x and Python 3.x are completely separated on the file system.

It only becomes a problem if either you or a library you are using, intentionally does something wrong by crossing the paths. As long as you don't alter the standard installation, you can use either one. For new code, it is generally recommended that you should write only Python 3.x code though.

2
  • I have installed pip for python 2 and I was going to install pip3 for python3 but it shows Unable to locate package python-pip3. The reason as I believe is that I already have pip. What should I do? Feb 21, 2017 at 15:47
  • Python 3.x packages are "python3-foo" not "python-foo3". You need python3-pip there.
    – dobey
    Feb 21, 2017 at 15:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .