i have import simplejson in my code, and installed using pip install simplejson using python3 so as i checked, it perfectly runs in my terminal opening the file but when i try to build in VScode, it shows an error like, see the error in this link as
`> Executing task: python /Users/Tony/Documents/python3.9/helloworld.py <
Traceback (most recent call last): File "/Users/Tony/Documents/python3.9/helloworld.py", line 1, in import simplejson as json ImportError: No module named simplejson The terminal process "/bin/bash '-c', 'python /Users/Tony/Documents/python3.9/helloworld.py'" failed to launch (exit code: 1).
but it still runs on my terminal. and if i check the pip list, simplejson is still there and i also tried to use different version of python too.
and I have activated the virtual environment enter image description here and i am using the last one which i recently activated.
please help me to find the error. i don’t really know where to fix thanks
I've reproduced this process and hope the following steps could help you
1.Activate the venv and install simplejson
;
2.Run the helloworld.py
in Terminal to make sure the script no error;
3.Configure the tasks.json
, pay attention to use the venv's pythonpath;
"version": "2.0.0",
"tasks": [
{
"label": "run python file",
"type": "shell",
"command": "/venv's pythonpath/ helloworld.py",
"group": {
"kind": "test",
"isDefault": true
},
"problemMatcher": [
"$tsc"
]
}
]
4.Tasks:Run Task;