I have some trouble to fix. I am using Python 3.2 with pyvisa for Python 3.2 32bits. When i used:
import pyvisa
It displayed:
ImportError: No module named enum
But when I use:
import pyqtgraph, pyvisa
I get:
ImportError: No module named cStringIO
I just want to use pyvisa for using an Agilent 33250a by GPIB.
The
enummodule wasn't part of Python until Python 3.4, so 3.2 is too early; you need to upgrade, or you need to live withoutenum(upgrading is a good idea mind you; the performance and features of Python have improved markedly since then; on performance in particular, strings and user defined class instances dramatically reduced their memory overhead). I'm guessingpyvisadropped support for Python versions older than 3.4 if they're depending onenum.cStringIOis a Python 2.x only accelerator module forStringIO; in Python 3.0 and higher, you just importioand useio.StringIO, and it will automatically use the C accelerated code under the hood when available, and pure Python code otherwise. If you're only targeting Python 3, just doimport ioorfrom io import StringIO. For code that should run under both Python 2 and Python 3, and usestrin both, you can do the following for imports:If you want to handle Unicode text regardless of Python version (well, in 2.6 and up), you can just use
io.StringIOexclusively; it works withunicodein Py2, andstrin Py3, which means it handles all text in both versions (wherecStringIOonly handlesstrin Py2, so it can't handle the whole Unicode range).I suspect your other import error for
pyqtgraphwould be because you tried installing a version ofpyqtgraphwritten for Python 2; thepyqtgraphpage claims Python 3.x compatibility, and use ofcStringIOwithout a fallback would not meet that claim, so either you installed the wrong version, or it was installed incorrectly (e.g. if they were using a single code base and2to3-ing it, but you somehow installed it without2to3-ing it; no idea how you'd do that).