Good day.
(Sorry, my eng not very good)
According to the GitHub issue(#395 and #272), this problem can be solved using this method
Solution:
Change param in Default Settings (JSON)
"code-runner.executorMap": { ... "python": "$pythonPath -u $fullFileName" ... }
You can set a static path to your Python from the virtual environment. And on the next run, the logic will be as in the screenshot below. (This way you won't encounter the error)