Ish*_*tta 2 python pip python-3.x scikit-learn visual-studio-code
我正在 VS Code 中工作,在已安装的名为where 的 conda环境中运行 Python 脚本。但是,当我导入它并运行脚本时,出现以下错误:myenvsklearn
Traceback (most recent call last):
File "d:\ML\Project\src\train.py", line 5, in <module>
from sklearn.linear_models import LinearRegression
ModuleNotFoundError: No module named 'sklearn'
Run Code Online (Sandbox Code Playgroud)
我已尝试了以下建议的所有可能的解决方案,但没有任何效果对我有用:
有人可以建议一种不同的方法来解决这个问题吗?
Gus*_*Fer 16
根据 pypi:
使用pip install scikit-learn而不是pip install sklearn
根据我的经验,这是有效的:
C:\Users\gfernandez>pip install sklearn
Collecting sklearn
Using cached sklearn-0.0.post1-py3-none-any.whl
Installing collected packages: sklearn
Successfully installed sklearn-0.0.post1
C:\Users\gfernandez>pip install scikit-learn
Requirement already satisfied: scikit-learn in c:\users\gfernandez\appdata\local\programs\python\python310\lib\site-packages (1.1.3)
Requirement already satisfied: scipy>=1.3.2 in c:\users\gfernandez\appdata\local\programs\python\python310\lib\site-packages (from scikit-learn) (1.9.3)
Requirement already satisfied: numpy>=1.17.3 in c:\users\gfernandez\appdata\local\programs\python\python310\lib\site-packages (from scikit-learn) (1.23.4)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\gfernandez\appdata\local\programs\python\python310\lib\site-packages (from scikit-learn) (3.1.0)
Requirement already satisfied: joblib>=1.0.0 in c:\users\gfernandez\appdata\local\programs\python\python310\lib\site-packages (from scikit-learn) (1.2.0)
C:\Users\gfernandez>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
23982 次 |
| 最近记录: |