La compilación de python2 en vscode da un error. Pero cuando compilo python3 tiene éxito.
print('test')devuelve: ImportError: ningún módulo llamado _thread
PS C:\source> c:; cd 'c:\source'; & 'C:\Python27\python.exe' 'c:\Users\keinblue\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\lib\python\debugpy\launcher' '52037' '--' 'c:\source\test.py' Traceback (most recent call last): File "C:\Python27\lib\runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name) File "C:\Python27\lib\runpy.py", line 72, in _run_code exec code in run_globals File "c:\Users\keinblue\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\lib\python\debugpy\__main__.py", line 43, in <module> from debugpy.server import cli File "c:\Users\keinblue\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\lib\python\debugpy/../debugpy\server\__init__.py", line 9, in <module> import debugpy._vendored.force_pydevd # noqa File "c:\Users\keinblue\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\lib\python\debugpy/../debugpy\_vendored\force_pydevd.py", line 37, in <module> pydevd_constants = import_module('_pydevd_bundle.pydevd_constants') File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module __import__(name) File "c:\Users\keinblue\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_constants.py", line 362, in <module> from _pydev_bundle._pydev_saved_modules import thread, threading File "c:\Users\keinblue\.vscode\extensions\ms-python.python-2022.4.0\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydev_bundle\_pydev_saved_modules.py", line 94, in <module> import _thread as thread; verify_shadowed.check(thread, ['start_new_thread', 'start_new', 'allocate_lock']) ImportError: No module named _threadHay un problema con la extensión python vscode versión 2022.4.0
simplemente cambie a la versión 2022.2.1924087327 y funcionará como funciona para mí ahora
Solo sigue estos pasos:
Creo que es la extensión VS Code Python. En VS Code, seleccione la extensión de Python y seleccione el menú desplegable Desinstalar para instalar una versión anterior, el 2022.2.xxx solucionó este problema. instalar versión anterior