How to make a python version as default version in ubuntu - python-3.x

Am using ubuntu 20.04 ,I have two versions of python installed 3.8.5 and 3.8.2. How to make Python 3.8.2 as the default version for python3
$ python3 -V
Python 3.8.5
$ python3.8 -V
Python 3.8.2

Related

latest python 3 not compatible in ubuntu

I installed python 3.8.4 in ubuntu 18.04 but still the
python3 --version
shows the version as 3.6.9
The python3.8.4 I installed was installed as python3.8 it did not replace the existing python3
how to do so?

upgrading python in Conda environment

I have python 2.7 installed on my Mac. I installed python 3.8.3 in an anaconda environment. However, when I type the command:
python --version
in the environment I still get python 2.7. how can I make my main python version 3.8.3 in this environment without completely getting rid of python 2.7

How to switch python version from 3.6.0 to 3.6.7 on Ubuntu 18.04?

I would am currently using python version 3.6.0 on Ubuntu 18.04 and need to use python version >= 3.6.1 to use PySlice_Unpack.
I have tried installing using the following commands:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
The output from these commands is:
python3.6 is already the newest version (3.6.7-1~18.04).
So it seems like I already have python 3.6.7 installed. However when I run the commands python -V, python3 -V, or python3.6 -V the output is
Python 3.6.0 :: Continuum Analytics, Inc.
In /usr/bin/ I have config files for python2.7, python3.6, python3.6m, python3, and python3m. I've looked at the python3.6 and python3 config files and they both have VERSION="3.6". How can I switch to using python version 3.6.7 instead of 3.6.0?
If you need a different version of Python (or other versions of python packages than those included in the version of Ubuntu you are using), then you might want to try using VirtualEnv, like explained in this answer: https://stackoverflow.com/a/5507373/483566

Different python versions in centos

I have a centos 7 machine , which has 2 python versions , python giver sveriosn 2.7.5 and python2.7 givers version . 2.7.13. I want to make 2.7.13 as default version, such that when I check python --version it gives 2.7.13 and not 2.7.5 . I have added both to PATH.
If you set Python 2.7.13 to your PATH and not 2.7.5, the used Python should be 2.7.13.
Or you can try to set the PYTHONPATH variable

Python virtualenv with Anaconda and python.org python 3.5

I have both anaconda Python 3.5 and Python 3.5 from python.org (on windows)
python -V
Python 3.5.1 :: Anaconda 4.0.0 (64-bit)
python3 -V
Python 3.5.1
py -V
Python 2.7.12
I want to create a virtualenv with only python 3.5.1 and not the anaconda version.
When I run
python3 c:\Python35\Tools\scripts\pyvenv.py venv
python -V still shows Python 3.5.1 :: Anaconda 4.0.0 (64-bit) after activating the environment
Is there anyway to get it to use the native 3.5 version?
You can use command line option -p during venv creation to force a particular interpreter to be used with it.
python3 c:\Python35\Tools\scripts\pyvenv.py -p python3 venv
Edited:
My bad, wrong virtual environment. As I can see you use venv from standard library and it's impossible to choose particular interpreter during virtual environment creation. On the other hand python3 -m venv venv command should use python3 interpreter for virtual environment which is one without anaconda in your case.
Edited 2:
I've just checked on windows:
C:\Users\usr>where python
C:\Python35\python.exe
C:\Users\usr\Anaconda3\python.exe
C:\Users\usr>C:\Users\usr\Anaconda3\python.exe --version
Python 3.5.2 :: Anaconda 4.1.1 (32-bit)
C:\Users\usr>C:\Users\usr\Anaconda3\python.exe -m venv myanacondavenv
C:\Users\usr>myanacondavenv\Scripts\activate.bat
(myanacondavenv) C:\Users\usr>python --version
Python 3.5.2 :: Anaconda 4.1.1 (32-bit)
(myanacondavenv) C:\Users\usr>deactivate
C:\Users\usr>C:\Python35\python.exe -m venv myvanilaenv
C:\Users\usr>myvanilaenv\Scripts\activate.bat
(myvanilaenv) C:\Users\usr>python --version
Python 3.5.1
(myvanilaenv) C:\Users\usr>deactivate
C:\Users\usr>
Reference

Resources