Python woes, works in CMD line, but not in PyCharm

Sep 11, 2021 2 Replies

Hi



So my first Python program, trying to get some data from a Siglent DMM



When I run CMD and Python, I can import a library called PyVisa, like this



import pyvisa



I can then connect and write to my instrument on USB



But, if I open PyCharm editor and write the same and execute, I get:



File "C:\Users\klaus\PycharmProjects\DCSweep2ndTry\main.py", line 1, in <module>



import pyvisa ModuleNotFoundError: No module named 'pyvisa'


So tried to look for pyvisa, but have no idea where is has been installed (did a search of the HDD, to no evail)



Any hints how to proceed?



Delete all programs and start again? (pyvisa is probably installed in a non typical way, in the Python environment, and I have no idea how to find it)



Regards



Klaus


lørdag den 11. september 2021 kl. 23.03.35 UTC+2 skrev Klaus Kragelund:

formatting link

I did find this initially. And did find 4 files listed in "Python interpreter". But I cannot remove any of them

That worked:

You can do this by going into Pycharm->Preferences->Project Interpreter and click the "+" sign to look for PyVISA and have pip install it for you. You should be able to import it afterwards.

Lasse, you have saved my day. Spend 2 hours sofar trying to get it working. Thank you very much

Regards

Klaus

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required