I have multiple python interperters in my computer 3.7 and 3.8. When I debug using with python 3.8 I do not face any issues using VSCode. My VScode python debugger fails when trying to debug with python 3.7. How do I install ctypes for python 3.7?

File "/home/kumar/.vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/python/debugpy/launcher/../../debugpy/launcher/debuggee.py", line 8, in <module>import ctypesFile "/usr/local/lib/python3.7/ctypes/__init__.py", line 7, in <module>from _ctypes import Union, Structure, ArrayModuleNotFoundError: No module named '_ctypes'
3

Best Answer


Try pip uninstall ctypes, and then uninstall and reinstall ur python 3.7 and then try again pip install ctypes and then import ctypes in python interpreter.

ctypes is a built in library (I think from python2.5)This means you dont need to install it, it is coming built in when you install python.

As far as using the correct version, see the pyenv module - it will make sure you are running the correct python version, and IMO makes life much easier

Have you checked which pip you are using? Make sure you have taken the right pip to install the package in the right place.

You can take pip --version command to check which pip you are using.