Search code examples
pythonimporterrorgetch

Why does it give me and ImportError when I am importing getch and have already installed it?


I'm trying to import getch with python:

from getch import getch

But it gives me an error like:

ImportError: /opt/virtualenvs/python3/lib/python3.8/site-packages/getch.cpython-38-x86_64-linux-gnu.so: undefined symbol: Py_InitModule

Any idea how to solve this?

(I have installed getch already)


Solution

  • Sounds related to this issue and the fact that getch was last updated in 2013 implying it is python 2 just like the issue. Try using python 2 or consider another package that doesn't have old c-bindings in it.