简体   繁体   中英

how to fix Import Error: No module named... in python with VScode

I am trying to import a module into vsCode. I have attached some photos of my current set up right. Things to note:

  • I am running the project in a virtual environment
  • My interpreter is set up to use this virtual env
  • I have my python:path set to run through the environment
  • I have the required modules in env/lib/ folder.

在此处输入图片说明 在此处输入图片说明

This results in an import error even though I believe I have taken the correct steps in setting up my python project in vscode. If someone has experienced anything similar can you please provide input on how to solve this issue?

Install code-runner and place code below in settings.json folder

    "code-runner.executorMap": {
        "python": "python3 -u",
    }

"python": "(the python version with modules) -u",

My guess is you never installed the requests module.

You need to do

pip install requests

for Python to find it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM