gpt4 book ai didi

python - 操作系统错误 : Could not open VISA library

转载 作者:太空狗 更新时间:2023-10-30 02:18:31 46 4
gpt4 key购买 nike

我刚刚在我的 mac 上安装了 pyvisa

$ pip install pyvisa

但是当我像这样使用 IDLE 测试它时:

import visa
rm = visa.ResourceManager()

我明白了:

    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:

如果我再次在终端中尝试“pip install”,我将得到以下结果:

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)

有人可以帮我解决我的问题吗?谢谢!

最佳答案

OSError 的发生是因为 PyVISA 在您的系统中找不到 VISA 库。 PyVISA 文档本身说:

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.

这可能意味着 VISA 库未安装在您的系统中,或者 VISA 库已安装但位于 PyVISA 不知道的目录中。

你必须先安装 NI-VISA 才能让 PyVisa 工作。 PyVisa 只是 NI-VISA 的 Python 绑定(bind)。

Here是下载 NI-VISA 并将其安装到您的系统的链接。


如果它仍然输出 OSError: Could not open VISA library,PyVISA 文档建议你做这样的事情。

visalib = VisaLibrary('/path/to/library')

rm = ResourceManager('Path to library')

您还可以求助于创建配置文件,如 Configuring the NI backend 中所述.

来源:http://pyvisa.readthedocs.org/en/stable/faq.html

关于python - 操作系统错误 : Could not open VISA library,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35544482/

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