Issue
I recently created a python project using scikit learn on PyCharm. First, I followed the sample code on official website
from sklearn import linear_model
and moved on to rest of the code.
Then I tried to run it on vscode, I set the interpreter to its venv, same as it was in pycharm, but i got the following error:
Traceback (most recent call last): from sklearn import linear_model ModuleNotFoundError: No module named 'sklearn'
which is weird because i have never seen this erron on pycharm.
any idea what is going wrong?
Steps/Code to Reproduce
just include from sklearn import linear_model in your code, assume you have installed the packages, both vscode and pycharm should compile and you wont see any error at this stage
Expected Results
run whatever the rest of your code is
Actual Results
get an error mentioned above
any help will be appreciated, thank you!
Solution
You can check it according to the following steps.
- Ensure that you have installed package in your venv environment.
- Use shortcuts Ctrl+Shift+P and type
Python: Select Interpreter
to change your python interpreter to venv environment. - Run your python file by clicking button Run Python File which is provided by Python extension instead of
Run Code
button. - If it still doesn't work, try to close all terminal and rerun your file.
Answered By - MingJie-MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.