我正在用numpy/scipy/ipython运行Win 7 x64,NI 488.2,PyVISA 1.5和python.我试图通过GPIB-USB连接联系吉时利仪器并发送简单命令.但是,当我尝试创建仪器对象时,我发现PyVISA的ResourceManager缺少用于查找,读取和写入仪器的必需方法.
I am running Win 7 x64, NI 488.2, PyVISA 1.5, and python with numpy/scipy/ipython. I am attempting to contact a Keithley instrument through a GPIB-USB connection and send simple commands. However, when I attempt to create the instrument object, I discovered that PyVISA's ResourceManager was missing the required methods used for finding, reading, and writing to instruments.
下面是PyVISA页面上的示例代码,我现在有:
Following the example code on PyVISA's page, right now I have:
import visa rm = visa.ResourceManager my_instrument = rm.get_instrument('GPIB::3')哪个返回错误,指出get_instrument不存在.使用制表符完成功能可以查看资源管理器rm的可用内容.揭示了它实际上缺少它应具有的所有方法,仅包含rm.init,rm.close和其他一些方法.这些都不执行任何操作或返回4099L.尝试调用rm本身只会打印字符串'ResourceManager()'.
Which returns an error that get_instrument doesn't exist. Using tab-completion to see what is available from the resource manager rm. reveals that it is lacking virtually all the methods it should have, containing only rm.init, rm.close, and a few others. These all either do nothing or return a 4099L. Attempting to call rm itself just prints the string 'ResourceManager()'.
进一步检查后,找不到签证Visa.VisaLibrary(),表明问题是安装不当;但是,在重新下载并重新安装整个软件包(使用pip)后,丢失文件的问题仍然存在.签证模块本身可以很好地加载,只是缺少了大部分重要文件.我是在搞砸安装,还是有其他事情发生?
Upon further examination, visa.VisaLibrary() is nowhere to be found, suggesting the problem is a botched installation; however, upon redownloading and reinstalling the entire package (using pip), the missing file problem persists. The visa module itself loads fine, it's just missing most of its important files. Am I screwing up the installation, or is there something else going on?
推荐答案事实证明,答案很简单,就像从其他位置下载软件包一样.显然,我使用的网站的DL软件包已损坏或不完整.
Turns out the answer was as simple as downloading the package from a different location. Apparently the site I used had a corrupted or incomplete package up for DL.
更多推荐
PyVISA缺少的方法
发布评论