5

My programming literacy is very basic, but I like programming and I have been taking some MOOC's to bring me into the 21st century.

I started off by taking a course in Python and installed 2.7.11 (from https://www.python.org/downloads/), now I am onto another course that requires Python 3.x

Can I simply install Python 3.x alongside the 2.x version (on my Mac)? Or, will that create all kinds of conflicts and problems? To add to the picture, I am just using the IDLE that comes along with the download.

If the solution involves a bunch of terminal line commands, or coordinating 3 additional downloads of other packages to make it happen, it is already out of my league. Like I said, I am coming into this as nearly a complete novice.

Thanks for you help.

4
  • It shouldn't create any conflicts simply install python3 with brew install python3 Commented Feb 27, 2016 at 16:16
  • @AndriyIvaneyko: What about shebang paths? I don't use OS X but I remember often having to edit or manually run Python scripts when Python 3 was new and python pointed to that on my system. Commented Feb 27, 2016 at 16:18
  • 1
    @MattiVirkkunen After installing python3 you would have two python interpreters python3 and python2.7, your python points to python2.7 as long as you don't change it, probably issue you pointed is related to changing default python interpreter, but that won't occur when you simply install python3 Commented Feb 27, 2016 at 16:20
  • Alright. Then it should be no problem. I guess I was just living on the "bleeding edge" and made Python 3 the default. Commented Feb 27, 2016 at 16:22

3 Answers 3

8

This might help anyone having Error: python 2.7.14 is already installed when trying to install python3 with brew install python3. Due to python2.7 being retired on 2020, python3 is now the same as python and python2 is python@2.

To fix the error, just run brew upgrade python and if you still want python2 you can install it by brew install python2. In my case I did not have to run the final command and I had both python installed.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I can confirm this works for me as well. I thought I had python3 already installed though, so I still find it kinda weird.
4

It shouldn't create any conflicts simply install python3 with brew install python3, also you get more info for doing it correctly in What is the correct way to install python on OS X? question.

NOTE: After installing python3 you would have two python interpreters python3 and python2.7, your python points to python2.7 as long as you don't change it, in other words your default python interpreter is python2.7 and do not change it without serious reason for that.

To run python3 scripts execute them with your python3 interpreter, tools like pip, easy_install, virtualenv for python3 shall be installed with that interpreter (python3).

1 Comment

This helped me: discourse.brew.sh/t/brew-install-python3-fails/1756/8, had to reinstal virtualenv again afterwards because was still using removed python version
1

You might want to look into pyenv: "pyenv lets you easily switch between multiple versions of Python". Also install-able with brew install pyenv

If you like programming you had better get used to doing a bit of setup and juggling of downloads. If you are going to do much python for different projects you would do well to understand virtualenv's before you find your projects' requirements conflicting.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.