Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Zbar + python, crashes on import (OSX 10.9.1)

I've attempted to install Zbar for use with python 2.7.6 with Homebrew and pip (brew install zbar, then pip install zbar) but every time I import it, python crashes. Simply running:

#!/usr/bin/python

import zbar

lands me with this from the terminal:

:~ aj$ cd '/Users/aj/Documents/nlcc/check in/python/' && '/usr/bin/python'
'/Users/aj/Documents/nlcc/check in/python/test.py' 
&& echo Exit status: $? && exit 1
Segmentation fault: 11

Other modules (wxPython, Numpy, openCV) work just fine, but this one gives me the same crash every time. I've tried compiling and installing zbar from source, thinking it might be an issue with Homebrew (or maybe even pip), but that has its own set of issues that are quite honestly over my head (i.e. missing a dylib after running ./configure with options, and then the developer's setup.py). Anyone have any ideas? Sorry if I'm missing any relevant info, if anyone would like any other logs, just let me know how to retrieve them, and I'll post them as soon as I can, like I said, a lot of this is over my head.

like image 815
AJM Avatar asked Feb 06 '14 20:02

AJM


1 Answers

I found the answer, but I wanted to post it here anyway in case anyone has the same trouble I did. You can use the brew installation of zbar, but you have to install to python via: pypi.python.org/pypi/zbar using this patch: https://github.com/npinchot/zbar/commit/d3c1611ad2411fbdc3e79eb96ca704a63d30ae69. Also, be sure to use which python in the terminal to make sure it's checking in the right directory. The only reliable way I found to make it do this was to edit ~/.bashrc and add the /usr/local/ and /usr/local/bin/ directories to it, and then source ~/.bashrc whenever I opened a terminal to install anything via pip or Homebrew.

Thanks for the tip about answering and accepting @lkraider

like image 117
AJM Avatar answered Oct 15 '22 21:10

AJM