NI VISA + pyVisa on Mac OS X (Snow Leopard)

Has anyone managed to run pyVisa on Snow Leopard with the NI GPIB module?

Based on all the forums that I read on the NI website, it looks like a combination of NI VISA and pyVisa can be done on Max OS X.

Alarming part is that on the NI website has support for NI VISA specified for the X OS the Mac . However, on their support pages, they do not list OS X as a supported OS.

Any comments or help would be greatly appreciated, as I would very much like to get away from having to use Windows to develop this software, as well as to support cross-platform.

+5
source share
3 answers

It turns out that NI-VISA 5.0 works well on 10.6.6.

The problem I ran into was calling pyVisa visa.Instrument ("GPIB :: 1"), which said that the library was not found. However, when calling visa.get_instruments_list (), my GPIB adapter displayed as GPIB0. Using this as a device, I was able to connect correctly.

There were a few changes that I had to make that were not well documented on the NI website (which I could find at least) to do this. Most important is the name of the VISA library that NI-VISA 5.0 installs. He is in /Library/Frameworks/Visa.framework/VISA. I have not tried modifying the nsi file to automatically link to this library, as the pyVisa documentation mentions.

pyvisa pip. easy_install. - pyvisa , , !

:

Python 2.7 virutalenv + virtualenvwrapper. 10.6.6. NI-VISA 5.0

:

from pyvisa.vpp43 import visa_library
visa_library.load_library("/Library/Frameworks/Visa.framework/VISA")
import visa
visa.get_instruments_list() # Yields: ['ASRL1', 'ASRL2', 'ASRL3', 'ASRL4', 'GPIB0::1']
temp = visa.Instrument("GPIB0::1")
print temp # Yeilds: Instrument("GPIB0::1::INSTR")

:
Lion . , - .

+6

NI-VISA-5.0.0, NI-VISA-5.1.2 PyVisa-1.4 OSX 10.8.2 (Mountain Lion), :

>>> import pyvisa.vpp43 as vpp43
>>> 
>>> 
>>> vpp43.visa_library.load_library('/Library/Frameworks/VISA.framework/VISA')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/PyVISA-1.4-py2.7.egg/pyvisa/vpp43.py", line 146, in load_library
    self.__lib = self.__cdecl_lib = cdll.LoadLibrary(path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 431, in LoadLibrary
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 353, in __init__
OSError: dlopen(/Library/Frameworks/VISA.framework/VISA, 6): no suitable image found.  Did find:
    /Library/Frameworks/VISA.framework/VISA: no matching architecture in universal wrapper
    /Library/Frameworks/VISA.framework/VISA: no matching architecture in universal wrapper
>>>
+3

Mountain Lion 10.8.5.

  • NI-VISA 5.4.
  • pyvisa

i386 Python ( Mac OS), Python 32- .

$ lipo -thin i386 -output python-i386 /usr/bin/python2.7
$ ./python-i386

:

# make sure pyvisa is available in the built-in python
import sys
sys.path.append('path-to-your-pyvisa')

from pyvisa.vpp43 import visa_library
visa_library.load_library("/Library/Frameworks/Visa.framework/VISA")
import visa
visa.get_instruments_list()
+1

All Articles