我想测试我的PyVISA安装,但出现了某些故障:
>>> 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:
>>>
我可能是什么问题?
我试图更新签证路径:
>>> 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
>>>
没有任何成功
最佳答案
PyVISA只是DLL的Python包装器,其标准位置在Windows中。例如,在我的PC上是C:\Windows\System32\visa64.dll
。
在我的代码中,我使用rm = visa.ResourceManager(C:\\Windows\\System32\\visa64.dll)
当然,第一次您必须获得VISA库,它是庞大的NI-VISA安装包的一部分,您可以在这里找到:
NI-VISA Download Installer
关于python - 是PyVISA安装失败吗?还是我做错了什么?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42644266/