Building Python 3 on OS X: [Python / importlib.h] Error 133

I am trying to create Python (3.5.2) on OS X El Capitan (10.11.5). However, I encounter an error while trying to make it. It seems that the error is related to _freeze_importlib .

 /usr/local/src/Python-3.5.2 $ make if test "no" != "yes"; then \ ./Programs/_freeze_importlib \ ./Lib/importlib/_bootstrap.py Python/importlib.h; \ fi dyld: lazy symbol binding failed: Symbol not found: _getentropy Referenced from: /usr/local/src/Python-3.5.2/./Programs/_freeze_importlib Expected in: /usr/lib/libSystem.B.dylib dyld: Symbol not found: _getentropy Referenced from: /usr/local/src/Python-3.5.2/./Programs/_freeze_importlib Expected in: /usr/lib/libSystem.B.dylib /bin/sh: line 1: 56666 Trace/BPT trap: 5 ./Programs/_freeze_importlib ./Lib/importlib/_bootstrap.py Python/importlib.h make: *** [Python/importlib.h] Error 133 /usr/local/src/Python-3.5.2 $ 

You can see my steps on github .

The full terminal output to make fail is in Gist .


I fully admit that this is an academic exercise since El Capitan ships with Python 2.7.10, and you can easily install Python 3.5.2 with the official OS X installer package or through Homebrew.

The documentation for Using Python on Unix platforms contains assembly instructions. The documentation for Using Python on Macintosh specifically talks about using the OS X installation package.

However, on a Mac it should be possible to build.

Python on a Macintosh running Mac OS X is basically very similar to Python on any other Unix platform, but there are a number of additional features such as an IDE and a package manager that are worth mentioning.

At this moment, I do not care about these additional features. Just wondering why I get a make error.

+8
python osx-elcapitan macos
source share
2 answers

Fixed.

On output ./configure I noticed a link to /Applications/Xcode-beta.app/Contents/Developer/ . A few days ago I installed Xcode 8 (beta). After returning to the usual command line tools (with Xcode 7.3.1)

 sudo xcode-select -s /Applications/Xcode.app/Contents/Developer 

make succeeded. Not ideal.

 Python build finished successfully! The necessary bits to build these optional modules were not found: _dbm _gdbm _sqlite3 _ssl nis ossaudiodev spwd zlib To find the necessary bits, look in setup.py in detect_modules() for the module name. Failed to build these modules: _lzma _tkinter 

I hope I do not need these modules.

I put the full output of ./configure and make into this Gist . I did not include the output for make install , because it was too long and seemed to only repeat make warnings and errors.

Notes

  • I did not use --enable-framework or --enable-universalsdk .
+5
source share

I think the best solution is xcode-select --install .

If you upgrade Xcode to 8 (beta), you need to run xcode-select --install to install all the build tools with it.

I ran into the same problem as yours and I can successfully install python via brew with Xcode8 after running xcode-select --install .

I hope this helps other people with the same issue.

+5
source share

All Articles