I'm new to python and I've been trying to update from python 2 to 3 by doing apt-get install python3 and it installed but when I type python --version on my terminal the version is 2.7.9. How can I uninstall python2 and make python3 the default version?
3 Answers
python2 and python3 are incompatible with each other, and a lot of the software only work with python2. So, apt-get does not overwrite python2 when you install python3.
You should call Python3 with python3 command and use #!/usr/bin/python3 as the shebang in your scripts.
Wing IDE has a configuration dialog box where you can set the path to your preferred python interpreter, over-riding the default.
To do so, select the Custom radio-button for Python Executable in the Project Properties dialog box and then either entering a path or clicking on the Browse button.
The Project Properties dialog is apparently accessible from the Project menu and the toolbar.
More info at https://wingware.com/doc/intro/tutorial-python-path
You may have to run python3 instead of python, python2 is still installed on your system.
-
okay I see, so the question should be how to remove python 2Katz– Katz2016-05-19 00:13:03 +00:00Commented May 19, 2016 at 0:13
-
You can remove the "python" package using apt-get remove python. You can check which file belongs to which package using dpkg -S .. e.g dpkg -S `which python`keda– keda2016-05-19 00:35:53 +00:00Commented May 19, 2016 at 0:35
-
I just read doing so is not a good idea, because a lot of things on my system are using python2 for functionality. I'm trying to make python3 the default version for Wing IDEKatz– Katz2016-05-19 00:37:58 +00:00Commented May 19, 2016 at 0:37
-
Or
#!/usr/bin/env python3RufusVS– RufusVS2020-09-24 16:11:31 +00:00Commented Sep 24, 2020 at 16:11