gpt4 book ai didi

python - 是PyVISA安装失败吗?或者,我做错了什么吗?

转载 作者:太空宇宙 更新时间:2023-11-03 15:34:25 31 4
gpt4 key购买 nike

我想测试我的 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:

>>>

我的问题可能是什么?

我尝试更新 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
>>> 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 中的某个位置。例如,在我的电脑上是 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/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com