Before I saw open source vs Code on Zhihu, I felt like this style very much, so I replaced sublimetext and atom
Because I was learning java before, I used idea more often, so I didn’t use it too many times after installation. Recently, I began to use Python to learn and write some crawlers. It’s troublesome to open pycharm every time, so it’s much more convenient to use vs code. As a result, the importerror: no module named requests error always appears every time you need to run after writing.
So, I checked whether I have installed these libraries. After checking for many times, I found that they are installed. You can view the installed libraries in the terminal through the following command
$pydoc modules
Or into python
>>> help("modules")
The effect of the two methods is the same
After that, I checked Google and changed it many times settings.json Still not.
Finally, on stack overflow, the author said it was a bug
It needs to be found through MAC: Command + Shift + B (Win: Ctrl + Shift + b)
Select other to create a new running script
Then enter the following code into the tasks.json in
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
//Python path
"command": "/usr/local/bin/python3",
//Name
"label": "python3",
"type": "shell",
"args": [
"${file}"
],
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": true,
"clear": false
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Run Python 3 with Command + Shift + B every time