Search code examples
pythonmacportspython-3.6

Python 3.6.2 installed with macport giving crashes when using from terminal


Upgraded my OS X to mac sierra ad updated macport (sudo port selfupdate). Then tried to run python from terminal and getting this error every time:

Python 3.6.2 (default, Jul 18 2017, 14:08:57) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Python(1316,0x7fffee2213c0) malloc: *** error for object 0x105b21698: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6

I installed py36-readline but it didn't help. How to fix this now?

I found this on GitHub: Crashes with Python 3.6 - MacOS Sierra, but did no help.


Solution

  • I found the solution! Its macports problem as pointed by Irmen de Jong in a comment. Installing py36-readline will not solve the problem as it says in the message after installing python36

    ##############################################################
    # IF YOU ARE USING PYTHON FROM THE TERMINAL, PLEASE INSTALL:
    #   py36-readline
    # TO AVOID A LIBEDIT / PYTHON INTERACTION ISSUE.
    # REF: https://trac.macports.org/ticket/48807
    ############################################################## 
    

    Solution is given at the REF link.
    Do the following:

    • Remove python36: sudo port uninstall python36
    • Remove py36-readline: sudo port uninstall py36-readline
    • Install python36 with sudo port install python36 +readline

    This will fix the error.