Should I install python 3

I have started playing with python, mostly because I just installed Sagemath, also to play with. I see that python 3.5.1 is out, whereas, OS X has python 2.7.1., and installing python 3 looks pretty straight forward; however; should I really bother to install it, or just stay with python2 that was included with 10.11?

I am using Zed Shaw's, Learn Python the Hard Way.

Thank you

iMac, OS X El Capitan (10.11)

Posted on Jun 2, 2016 7:28 PM

Reply
3 replies

Jun 3, 2016 5:48 AM in response to danuke

Hello danuke,

Python is what people refer to as a "big can-o-worms". From what I understand, there are significant differences between version 2.7 and 3. If you ever had to deal with how much trouble 2.6 vs 2.7 was, then you might think twice about 3.5.


In any event, you should be aware that all Apple software, including Apple's python build, is off limits. Whatever you want to do in Python, you should download your own version, even if it is the same as what ships with the OS, and use that. Apple's version of Python is for Apple's use alone. From a developer's point of view, it is fundamentally crippled and unusable. System Integrity Protection makes it impossible to install any extensions or modules. And for the record, this advice doesn't just apply to Python either. You should download and build all of your own software. Do NOT rely on Apple's software. You will be sorry if you do.

Jun 3, 2016 5:47 AM in response to etresoft

Howdy etresoft,

Thank you for your insights.

I googled around, and it almost sounds like python is a default include with Unix, but I did not see any references as to why or what Apple uses python for.


I also take your point and installed python 3.5 and I call it using command line 'python3' via an alias named hiss, for later use or for use with online examples i.e. the fibonacci demonstration module which will not work with 2.7. The installer worked perfectly and python 2 remains the default version.


It appears that one of the big differences between the two is the formatted print function in 3.x and Shaw's book is written for for python 2. So I suppose that I will continue on with that until I decide to buy a python 3 book, but then again why not use python3 in the book and see the errors that result i.e. really learning the hard way😁

Jun 3, 2016 4:22 PM in response to danuke

If you want your own Python 2.7.11, or Python 3.5.1, use homebrew and install these Python environments into your /usr/local/bin and /usr/local/lib locations. Then you need a means to switch your Python library paths between the two versions, and away from Apple's Python 2.7.10 environment. If you Google Python version manager, you will get hits for pyenv and others. As a die hard, I patched the discontinued Pythonbrew and still use it to install and manage multiple Python versions, which I can switch to with ease. Any Python solutions that I post in the support communities only use built-in Python modules.


Some of Apple's own products depend on the OS X installed version of Python. Additionally, the Python Scripting Bridge expects Apple's Python. This allows one to write Python-Objective-C code, but only in Apple's Python installation. The PDF watermark action in Automator uses Python, as do many other obscure OS X installed bits.


Python dot org has documentation that talks about differences between Python 2 and 3. I have written Python applications that automatically run correctly under Python 2.7.10, 2.7.11, and Python 3.5.1 without any changes. Some Python 3 features have already been back ported to Python 2.7.11.


To find how to do something in Python, type the following question format in your browser: Python List Comprehensions, or Python merge two lists.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Should I install python 3

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.