How to Make Python3 Command Run Python 3.6 Instead of 3.5

How to make python3 command run Python 3.6 instead of 3.5?

do

rm /usr/bin/python3
ln -s /usr/bin/python3.6 /usr/bin/python3

much better solution:

Damn, Python is used throughout much of Ubuntu for system scripts and software, and software relies on having Python (and the commands to start Python) in a certain spot. do back then.

rm /usr/bin/python3 
ln -s /usr/bin/python3.5 /usr/bin/python3

create alias in ~/.bash_aliases

alias python3='/usr/bin/python3.6' 

Scripts can then start with something like:

#!/usr/bin/env python3 

How to use pip3 for python 3.6 instead of python 3.5?

Your version of pip is inextricably linked to your version of Python, you cannot tell pip "use this Python" or "use that Python." If you have a version mismatch between pip3 (using Python 3.X) and python3 (being Python 3.Y), it means your problem is with multiple overlapping distributions of Python and a weirdly configured $PATH.

If you run pip3 --version it will tell you the site-packages directory and Python version number that pip3 is associated with.

If you run python3 and then execute >>> import site; site.getsitepackages(), it should print the site-packages directory your python3 is using.

If these do not match, you've got path problems and you'll need to post more information about what operating system you're on, what Python distributions you're using, and how you installed them.

Update/Summary of Comment Thread: Original poster had a distribution-bundled Python 3.6 installed alongside a self-installed Python 3.5. The pip3 on their path was associated with Python 3.6 (system Python), while the command python3 was associated with Python 3.5 (their self-installed Python). Resolution:

Run which -a python3 to find Python 3.5. Add the location of Python 3.5 to your $PATH. (Do it in .profile or .bash_profile to make it permanent.)

How to change python version in Anaconda?

A better (recommended) alternative is to create a virtual environment of the desired Python version and then use that environment to run Tensorflow and other scripts.

To do that, you can follow the instructions given here.

BUT, if you don't want to create a separate environment, then conda install python=<version> should do.

OR (not recommended) you can download the "latest" Anaconda installer with your required Python version bundled.

Source

Pip for Python 3.8

Install pip the official way:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.8 get-pip.py

made 3.8 my default Python version

It depends on how you did that, but it might break something in your OS. For example some packages on Ubuntu 18.04 might depend on python being python2.7 or python3 being python3.6 with some pip packages preinstalled.

python3' is not recognized as an internal or external command, operable program or batch file

There is no python3.exe file, that is why it fails.

Try:

py

instead.

py is just a launcher for python.exe. If you have more than one python versions installed on your machine (2.x, 3.x) you can specify what version of python to launch by

py -2 or
py -3



Related Topics



Leave a reply



Submit