I installed ubuntu, as I understood with it, Python2.7 was installed in the folder /home/user/.local/lib. I installed Python3.5 and then through pip I download all sorts of libraries for myself, in particular, scipy and it is installed in the Python 2.7 folder, and I do not use version 2 of python.

Help me either remove python 2.7 or prioritize 3.5. In the Google I can not find enough information to solve.

  • one
    @MaxU and what have the anaconda? - Vorobey.A
  • one
    The problem is not what library to use, I just cited it as an example, but how to make the library not swing in version 2.7 of python, but in 3.5 - Vorobey.A
  • one
    sudo update-alternatives --install / usr / bin / python python /usr/bin/python3.5 1 I still don’t understand how, but this command helped me to solve the problem) - Vorobey.A
  • four
    1- Do not touch the system Python (the consequences may not be obvious). This does not prevent you from using at least ten versions of Python if you wish. For example, you can even try other implementations of Python such as pypy, jython. These things are not connected in any way¶ 2- you have an XY-problem : the system pip uses the system python . To use python3, you can use pip3 (or python3 -mpip ), but it's better to python3 -mpip in virtualenv (eg, virtualenv -p python3 venv ). For convenience, you can put virtualenvwrapper . - jfs

3 answers 3

Use pip3 or python3 -m pip to run pip for Python 3

 $ pip3 --version pip 9.0.1 from /home/r033/.local/lib/python3.5/site-packages (python 3.5) $ python3 -m pip --version pip 9.0.1 from /home/r033/.local/lib/python3.5/site-packages (python 3.5) 

You can also install libraries through the Ubuntu repositories, if they are there.

 sudo apt install python3-scipy 

    Try running pip like this:

     sudo python3 -m pip 

    PS A scipy for python3 in ubuntu can be put like this:

     sudo apt-get install python3-scipy 

      If I understand you correctly, it will help you:

       sudo ln -sf python3 /usr/bin/python 

      This command will replace the python link in /usr/bin

      After that, python will open the python3 interpreter.