I would like to ask if it is possible to make Python 3 a default interpreter on Mac OS 10 when typing python right away from the terminal? If so, can somebody help how to do it? I'm avoiding switching between the environments.
Cheers
I would like to ask if it is possible to make Python 3 a default interpreter on Mac OS 10 when typing python right away from the terminal? If so, can somebody help how to do it? I'm avoiding switching between the environments.
Cheers
Method 1:
In ~/.bash_profile
, set an alias for your python3
alias python='python3'
Method 2(I use this way to keep multiple python versions):
Install python3(the virtualenv python3 on my machine is env-3.5) by virtualenv
, in ~/.bash_profile
activate certain virtual environment:
source /Users/username/.virtualenvs/env-3.5/bin/activate
I suggest use a virtual environment, it will affect your system even packages messed up.
Did research on anaconda which data_garden commented. Here I post how I installed it:
export PATH=$HOME/anaconda3/bin:$PATH
into .bash_profile
conda search "^python$"
conda create -n env-3.6.5 python=3.6.5
, env-3.6.5 is the name of the new created envsource activate env-3.6.5
, add it into .bash_profile
Done!
You can run conda env list
to display all virtual environments you have created.
You can do that by changing alias, typing in something like $ alias python=python3
in the terminal.
If you want the change to persist open ~/.bash_profile
using nano and then add alias python=python3
. CTRL+O to save and CTRL+X to close.
Then type $ source ~./bash_profile
in the terminal.