Python: aliased to python3
Asked Answered
T

2

6

I tried to upgrade python 2.7 to python 3 and I modified the file ~/.bash_aliases but when I type python in elementary terminal I get this error

zsh: command not found: python3

and when I type which python

python: aliased to python3

actually I prefer return to python 2.7 or if someone know how can I fix this :c

Timmie answered 19/12, 2014 at 15:45 Comment(5)
You are using zsh. Does zsh read .bash_aliases or .bashrc?Dismantle
If neither of those files, run a grep python3 ~/.* through all dot-files files in your home directory; possibly the alias turns up.Snapper
Please post the contents of your ~/.zshrc file, if it exists.Dismantle
Can you run the python3 command successfully without the alias?Machree
i delete the file bash_aliases and i could run python. But im very intersted to update python 3.4 :cTimmie
D
22

Go into your .zshrc file. Is there a line that reads:

alias python='python3'

If so, remove that line. Else, check if you can run python2, python2.7, or something like that. If so, then just hack and add the line

alias python='python2'

Or whatever your python2 is. Else, type

sudo apt-get install python2.7

Or whatever is the appropriate method for installing programs on your system.

Dormitory answered 16/2, 2015 at 6:17 Comment(2)
On mac, when I do this, I can't run that came installed with Python3. See my answer belowBosquet
After you make changes to ~/.zshrc and save the file, don't forget to run source ~/.zshrc to apply the changes.Nightrider
B
1

Follow this steps if you are using macOS.

  1. Install Python with brew: brew install python. This will install the latest version of Python. If you want Python 2.7, do well to specify the version.
  2. Check the path where this Python was installed: brew info python. You will see a path similar to: /usr/local/opt/[email protected]/libexec/bin
  3. Make home brew Python default:
$ echo 'export PATH="/usr/local/opt/[email protected]/libexec/bin:$PATH"' >> ~/.zshrc
  1. Source the file to apply changes without restarting the terminal: source ~/.zshrc
Bosquet answered 5/10, 2021 at 9:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.