ImportError: No module named

守給你的承諾、 提交于 2019-12-22 18:00:37

问题


I'm migrating PyVisa from Python 2.6 to Python 3.2. I'm able to install the module. It's listed in C:\Python32\Lib\site-packages\pyvisa

The __init__.py file imports a module (vpp43.py) from this folder. At this line I get following error:

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

Where is the mistake?


回答1:


In Python 3.x implicit relative imports have gone away. Instead of

import configparser, os, sys, vpp43

pyvisa\__init__.py needs to say:

import configparser, os, sys
from . import vpp43


来源:https://stackoverflow.com/questions/8605036/importerror-no-module-named

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!