我正在将PyVisa从Python 2.6迁移到Python 3.2。我可以安装模块。
它列在C:\Python32\Lib\site-packages\pyvisa
__init__.py
文件从此文件夹导入模块(vpp43.py
)。在这一行,我得到以下错误:
Traceback (most recent call last): File "D:\Documents and Settings\grknbl16\My Documents\PatternControl.py", line 2, in <module> from taborAwg import configTabor File "D:\Documents and Settings\grknbl16\My Documents\taborAwg.py", line 1, in <module> from visa import Instrument, vpp43 File "C:\Python32\lib\site-packages\visa.py", line 1, in <module> from pyvisa.visa import * File "C:\Python32\lib\site-packages\pyvisa\__init__.py", line 34, in <module> import configparser, os, sys, vpp43 ImportError: No module named vpp43
错误在哪里?
答案 0 :(得分:7)
在Python 3.x中,隐含的相对导入已经消失。而不是
import configparser, os, sys, vpp43
pyvisa\__init__.py
需要说:
import configparser, os, sys
from . import vpp43