pythonvisapyvisa

Is it a PyVISA installation failure ? Or, am I doing something wrong?


I wanted to test my PyVISA installation and got a certain failure:

>>> import visa
>>> rm = visa.ResourceManager()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Program Files\Python35\lib\site-packages\pyvisa\highlevel.py", line 1
488, in __new__
visa_library = open_visa_library(visa_library)
File "C:\Program Files\Python35\lib\site-packages\pyvisa\highlevel.py", line 1
460, in open_visa_library
return cls(argument)
File "C:\Program Files\Python35\lib\site-packages\pyvisa\highlevel.py", line 9
6, in __new__
raise OSError('Could not open VISA library:\n' + '\n'.join(errs))
OSError: Could not open VISA library:

>>>

What could be my problem ?

I have tried to update the VISA path:

>>> rm = ResourceManager('C:\Program Files\Python35\Lib\site-packages')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ResourceManager' is not defined
>>> visalib = VisaLibrary('C:\Program Files\Python35\Lib\site-packages')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'VisaLibrary' is not defined
>>> rm = ResourceManager('C:/Program Files/Python35/Lib/site-packages')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ResourceManager' is not defined
>>> import visa
>>> rm = ResourceManager('C:\Program Files\Python35\Lib\site-packages')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ResourceManager' is not defined
>>>

Without any success


Solution

  • PyVISA is only Python wrapper for DLL which standard location is somewhere in Windows. For example at my PC is C:\Windows\System32\visa64.dll.

    At my code i use rm = visa.ResourceManager(C:\\Windows\\System32\\visa64.dll)

    Of course first time you have to get VISA library which is part of huge NI-VISA installation package which you can found here: NI-VISA Download Installer