<bdo id='gSCUf'></bdo><ul id='gSCUf'></ul>
      1. <legend id='gSCUf'><style id='gSCUf'><dir id='gSCUf'><q id='gSCUf'></q></dir></style></legend>
      2. <i id='gSCUf'><tr id='gSCUf'><dt id='gSCUf'><q id='gSCUf'><span id='gSCUf'><b id='gSCUf'><form id='gSCUf'><ins id='gSCUf'></ins><ul id='gSCUf'></ul><sub id='gSCUf'></sub></form><legend id='gSCUf'></legend><bdo id='gSCUf'><pre id='gSCUf'><center id='gSCUf'></center></pre></bdo></b><th id='gSCUf'></th></span></q></dt></tr></i><div id='gSCUf'><tfoot id='gSCUf'></tfoot><dl id='gSCUf'><fieldset id='gSCUf'></fieldset></dl></div>
        <tfoot id='gSCUf'></tfoot>

        <small id='gSCUf'></small><noframes id='gSCUf'>

        PyVISA未列出Linux上的USB仪器

        时间:2024-08-21
          <i id='jnY3b'><tr id='jnY3b'><dt id='jnY3b'><q id='jnY3b'><span id='jnY3b'><b id='jnY3b'><form id='jnY3b'><ins id='jnY3b'></ins><ul id='jnY3b'></ul><sub id='jnY3b'></sub></form><legend id='jnY3b'></legend><bdo id='jnY3b'><pre id='jnY3b'><center id='jnY3b'></center></pre></bdo></b><th id='jnY3b'></th></span></q></dt></tr></i><div id='jnY3b'><tfoot id='jnY3b'></tfoot><dl id='jnY3b'><fieldset id='jnY3b'></fieldset></dl></div>
        1. <tfoot id='jnY3b'></tfoot>

            <tbody id='jnY3b'></tbody>

            <small id='jnY3b'></small><noframes id='jnY3b'>

            • <legend id='jnY3b'><style id='jnY3b'><dir id='jnY3b'><q id='jnY3b'></q></dir></style></legend>
              • <bdo id='jnY3b'></bdo><ul id='jnY3b'></ul>
                  本文介绍了PyVISA未列出Linux上的USB仪器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试从树莓PI与LeCroy WaveRunner 640Zi示波器通信,它们是通过USB电缆连接的。我已经在Windows下执行过此操作,但现在无法在Linux上运行。

                  如果我运行lsusb,我会看到以下内容:

                  $ lsusb
                  Bus 001 Device 009: ID 05ff:1023 LeCroy Corp.
                  ...
                  

                  如果我现在转到Python,我会得到这样的信息:

                  $ python3
                  Python 3.7.3 (default, Dec 20 2019, 18:57:59) 
                  [GCC 8.3.0] on linux
                  Type "help", "copyright", "credits" or "license" for more information.
                  >>> import pyvisa
                  >>> pyvisa.ResourceManager().list_resources()
                  ('ASRL/dev/ttyAMA0::INSTR',)
                  >>> 
                  

                  示波器不在那里(我认为ASRL/dev/ttyAMA0::INSTR是来自Raspberry Py本身的东西)。我认为示波器配置正确,因为如果我转到Options(使用示波器本身的屏幕),然后转到";Remote Options&Quot;,我看到它是为USB设置的,VISA地址是USB0::bla::bla::bla::INSTR

                  我尝试按照this page中的说明继续操作,但不起作用。如果我运行python3 -m visa info,我会收到

                  $ python3 -m visa info
                  ~/.local/lib/python3.7/site-packages/visa.py:23: FutureWarning: The visa module provided by PyVISA is being deprecated. You can replace `import visa` by `import pyvisa as visa` to achieve the same effect.
                  
                  The reason for the deprecation is the possible conflict with the visa package provided by the https://github.com/visa-sdk/visa-python which can result in hard to debug situations.
                    FutureWarning,
                  Machine Details:
                     Platform ID:    Linux-4.19.97-v7+-armv7l-with-debian-10.3
                     Processor:      
                  
                  Python:
                     Implementation: CPython
                     Executable:     /usr/bin/python3
                     Version:        3.7.3
                     Compiler:       GCC 8.3.0
                     Bits:           32bit
                     Build:          Dec 20 2019 18:57:59 (#default)
                     Unicode:        UCS4
                  
                  PyVISA Version: 1.11.3
                  
                  Backends:
                     ivi:
                        Version: 1.11.3 (bundled with PyVISA)
                        Binary library: Not found
                     py:
                        Version: 0.5.2
                        ASRL INSTR: Available via PySerial (3.4)
                        USB INSTR: Available via PyUSB (1.0.2). Backend: libusb1
                        USB RAW: Available via PyUSB (1.0.2). Backend: libusb1
                        TCPIP INSTR: Available 
                        TCPIP SOCKET: Available 
                        GPIB INSTR:
                           Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of funcionality.
                           No module named 'gpib'
                  

                  我还尝试在没有列出资源";的情况下连接示波器,方法是执行pyvisa.ResourceManager().open_resource('USB0::bla::bla::bla::INSTR'),但得到:

                  >>> osc = pyvisa.ResourceManager().open_resource('USB0::0x05ff::0x1023::2810N60091::INSTR')
                  Traceback (most recent call last):
                    File "<stdin>", line 1, in <module>
                    File "~/.local/lib/python3.7/site-packages/pyvisa/highlevel.py", line 3304, in open_resource
                      res.open(access_mode, open_timeout)
                    File "~/.local/lib/python3.7/site-packages/pyvisa/resources/resource.py", line 298, in open
                      self._resource_name, access_mode, open_timeout
                    File "~/.local/lib/python3.7/site-packages/pyvisa/highlevel.py", line 3232, in open_bare_resource
                      return self.visalib.open(self.session, resource_name, access_mode, open_timeout)
                    File "~/.local/lib/python3.7/site-packages/pyvisa_py/highlevel.py", line 167, in open
                      sess = cls(session, resource_name, parsed, open_timeout)
                    File "~/.local/lib/python3.7/site-packages/pyvisa_py/sessions.py", line 323, in __init__
                      self.after_parsing()
                    File "~/.local/lib/python3.7/site-packages/pyvisa_py/usb.py", line 84, in after_parsing
                      self.parsed.serial_number,
                    File "~/.local/lib/python3.7/site-packages/pyvisa_py/protocols/usbtmc.py", line 287, in __init__
                      super(USBTMC, self).__init__(vendor, product, serial_number, **kwargs)
                    File "~/.local/lib/python3.7/site-packages/pyvisa_py/protocols/usbtmc.py", line 199, in __init__
                      raise ValueError("No device found.")
                  ValueError: No device found.
                  >>> 
                  
                  

                  推荐答案

                  我设法找到了一个为子孙后代分享的解决方案。我只需向内容为SUBSYSTEM=="usb", MODE="0666", GROUP="usbusers"的文件/etc/udev/rules.d/99-com.rules添加一行(如果文件已存在,则追加该行),然后重新启动计算机。总结:

                  1. 进入sudo环境:
                  sudo su
                  
                  1. 现在将所需的行添加到各自的文件中:
                  echo 'SUBSYSTEM=="usb", MODE="0666", GROUP="usbusers"' >> /etc/udev/rules.d/99-com.rules
                  
                  1. 重新启动计算机

                  2. 尽情享受。

                  $ python3
                  Python 3.7.3 (default, Dec 20 2019, 18:57:59) 
                  [GCC 8.3.0] on linux
                  Type "help", "copyright", "credits" or "license" for more information.
                  >>> import pyvisa
                  >>> pyvisa.ResourceManager().list_resources()
                  ('ASRL/dev/ttyAMA0::INSTR', 'USB0::bla::bla::bla::INSTR')
                  >>>  osc = pyvisa.ResourceManager().open_resource('USB0::bla::bla::bla::INSTR')
                  >>> osc.query('*IDN?')
                  '*IDN LECROY,WR640ZI,LCRY28blablabla,7.7.1
                  '
                  

                  这篇关于PyVISA未列出Linux上的USB仪器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在python中按多个条件合并不同数量的行和列 下一篇:用Python实现与USB设备的通信

                  相关文章

                • <i id='Qxk13'><tr id='Qxk13'><dt id='Qxk13'><q id='Qxk13'><span id='Qxk13'><b id='Qxk13'><form id='Qxk13'><ins id='Qxk13'></ins><ul id='Qxk13'></ul><sub id='Qxk13'></sub></form><legend id='Qxk13'></legend><bdo id='Qxk13'><pre id='Qxk13'><center id='Qxk13'></center></pre></bdo></b><th id='Qxk13'></th></span></q></dt></tr></i><div id='Qxk13'><tfoot id='Qxk13'></tfoot><dl id='Qxk13'><fieldset id='Qxk13'></fieldset></dl></div>
                • <tfoot id='Qxk13'></tfoot>

                    1. <legend id='Qxk13'><style id='Qxk13'><dir id='Qxk13'><q id='Qxk13'></q></dir></style></legend>

                        <bdo id='Qxk13'></bdo><ul id='Qxk13'></ul>

                    2. <small id='Qxk13'></small><noframes id='Qxk13'>