Search code examples
pythonvisual-studio-codeimportredispydev

Unresolved import error in VSCode with PyDev?


I deleted an old Python version (3.6) from my PC, but after that the VSCode underlining my imports (redis, pandas etc). The codes are perfectly running, but the red underline is kinda annoying. Any idea how could I solve this problem? I'm using Python 3.8.5 64-bit ('base':conda) as a default interpreter. The error message: Unresolved import: redisPyDev(6).

This is the test code:

import redis 

redis_host = ""
redis_port = 

r = redis.Redis(host=redis_host, port=redis_port, db=0, decode_responses=True)

print(r.get('str_id'))

Solution

  • According to the information you provided, "Unresolved import: redisPyDev" is provided by the VS Code extension "PyDev". If you do not use this extension, please try to "disable" it.

    Usually, when we use python in VS Code, many of its functions are provided by the Python extension. When I did not install the module "redis", here is the "unresolved import'redis'" information provided by the python extension:

    enter image description here

    After we installed the module "redis", then reload VS Code, no errors or warnings are displayed here:

    enter image description here