0

I have both python 2.7 and python 3.7 installed on my system. the issue here is python2 still overrides python3.i mean when trying to install new packages, it still displays the DEPRECATION message. please how do i make python3 my main python version and use it?

if i try 'sudo-apt-update' it always throws back this error message: ModuleNotFoundError: No module named 'apt_pkg'

Please how can i solve all these? i believe its the python2 causing the problem. i am considering to uninstall it. which way forward?

  • In /usr/bin, try unlinking python and then relinking python3 to python. – cup Mar 08 '20 at 10:53
  • please how can i do that? i am in the /usr/bin directory i dont know which file to edit. – Unique Ezra Mar 08 '20 at 11:01
  • You haven't said what OS/release you are using, but currently supported releases of Ubuntu should have python2 and python3 installed & working. For most releases, python should default to python2 but as you haven't given your release, we cannot be specific (python3 -V reports 3.8.2 for my release, but your release likely should report a 2 release) – guiverc Mar 08 '20 at 11:25
  • I am using Ubuntu 18.04.4 LTS. python3 -V reports python 3.7.5 on the terminal. The issue is, python2 still runs as default. using the command python --version it displays Python 2.7.16 :: Anaconda, Inc. – Unique Ezra Mar 08 '20 at 11:43
  • Solved in 20.04 - the python command has been removed completely. Use python2 or python3 appropriately. – user535733 Mar 08 '20 at 18:13
  • @user535733 how do you mean? – Unique Ezra Mar 10 '20 at 09:34
  • @UniqueEzra you are essentially asking "How do I make the python command use Py3 instead of Py2?" DON'T DO IT - On 18.04, that will cause breakage. Use the command python3 to refer to Py3. – user535733 Mar 10 '20 at 13:26

0 Answers0