Search code examples
pythonraspberry-pi4snap7

Why does the Snap7 library for Python work inside the terminal but not when I try to use it in PyCharm or another IDE?


So I've been trying to install the snap7 library on a Raspberry Pi 4(buster) in order to work with it in python. However, it seems that when I try to run some commands inside the terminal:

python3
import snap7
plc = snap7.client.Client()

everything works fine.(it also works if I try to create a script in nano for example)

When I try to run the same script inside PyCharm I get an error saying that "ModuleNotFoundError: No module named 'snap7'". Does anyone have any idea what the problem might be and how to solve it?


Solution

  • I solved it by installing other python instance. Used to have 3.12.2 and I changed to 3.11.8 and reinstalled the snap7 module.