I have just installed pyvisa on my mac with
$ pip install pyvisa
But when I was to test it using IDLE like this:
import visa
rm = visa.ResourceManager()
I got this:
Traceback (most recent call last):
File "<pyshell#3>", line 1, in <module>
rm = visa.ResourceManager()
File "/Users/siyuqi/Library/Python/2.7/lib/python/site-packages/pyvisa/highlevel.py", line 1488, in __new__
visa_library = open_visa_library(visa_library)
File "/Users/siyuqi/Library/Python/2.7/lib/python/site-packages/pyvisa/highlevel.py", line 1460, in open_visa_library
return cls(argument)
File "/Users/siyuqi/Library/Python/2.7/lib/python/site-packages/pyvisa/highlevel.py", line 96, in __new__
raise OSError('Could not open VISA library:\n' + '\n'.join(errs))
OSError: Could not open VISA library:
If I try 'pip install' in Terminal again, I will get the following result:
Requirement already satisfied (use --upgrade to upgrade): pyvisa in ./Library/Python/2.7/lib/python/site-packages
Requirement already satisfied (use --upgrade to upgrade): enum34 in ./Library/Python/2.7/lib/python/site-packages (from pyvisa)
Could anybody please kindly help me solve my problem? Thanks!
The OSError
occurs because PyVISA could not find the VISA library in your system. From the PyVISA documentation itself it says:
OSError: Could not open VISA library
This error occurs when you have not provided a path for the VISA library and PyVISA is not able to find it for you.
This could mean that the VISA library is not installed in your system or the VISA library is installed but in a directory that PyVISA does not know about.
You have to first install NI-VISA for PyVisa to work. PyVisa is only a Python binding for NI-VISA.
Here is a link to download and install NI-VISA to your system.
If it still outputs OSError: Could not open VISA library
, the PyVISA documentation suggests that you do something like this.
visalib = VisaLibrary('/path/to/library')
or
rm = ResourceManager('Path to library')
You can also resort to creating a configuration file as described in Configuring the NI backend.
Source: http://pyvisa.readthedocs.org/en/stable/faq.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With