Mac Python Cannot load the LJM library | LabJack
 

Mac Python Cannot load the LJM library

2 posts / 0 new
Last post
SteveK
SteveK's picture
Mac Python Cannot load the LJM library

Hi

I am on a mac running Sierra 10.12.2. Starting to look at using Python 2.7 to talk to a T7.

I  installed the LJM library and Kipling seems to work as expected.

I then installed  LJM Python v1.1.0. Installation seemed to proceed OK.

Then

sudo python t7.py

gives the error:

Cannot load the LJM library libLabJackM.dylib. dlopen(libLabJackM.dylib, 6): image not found

Any suggestions?

Thanks

LabJack Support
labjack support's picture
In the Python LJM download,

In the Python LJM download, modify this line of code in the ljm.py file (in the \labjack\ljm directory):

if(sys.platform.startswith("darwin")):
                #Mac OS X
                libraryName = "libLabJackM.dylib"

To:

if(sys.platform.startswith("darwin")):
                #Mac OS X
                libraryName = "/usr/local/lib/libLabJackM.dylib"

Then reinstall the Python LJM package with the modification and see if that helps with the image not found error.

We've been noticing on newer Mac OS X / macOS versions that the /usr/local/lib directory is not always included in the system's library search path, so the path to our library needs to be included when loading it. In a future update we will include a similar change to Python LJM for Mac users.