运行python项目出现ModuleNotFoundError: No module named ‘sklearn‘问题

问题1:ModuleNotFoundError: No module named 'sklearn'

1.Windows+R键,输入cmd,进入命令行窗口

2.安装sklearn,使用清华镜像安装:

python -m pip install scikit-learn -i https://pypi.tuna.tsinghua.edu.cn/simple

指定版本写法,安装包==版本号,如:scikit-learn==1.2.2:

python -m pip install scikit-learn==1.2.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

安装完成:

问题2:ModuleNotFoundError: No module named 'rule_engine'

解决:打开安装python目录,查看文件夹是否包含以下两个文件,如有可以进行下面的操作:

地址栏输入cmd,打开命令行窗口,安装rule_engine

pip3 install rule-engine

出现D:\software\Python\python.exe: No module named pip,输入命令:

#执行第一个命令
python -m ensurepip

#执行第二个命令
pip3 install rule-engine

安装完成: 

问题3:ModuleNotFoundError: No module named 'pandas'

安装pandas

pip install pandas -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

出现ERROR: Could not find a version that satisfies the requirement pandas (from versions: none)
ERROR: No matching distribution found for pandas
,输入命令:

py -3 -m pip install pandas

安装完成: 

查看pip版本命令:

pip list

猜你喜欢

转载自blog.csdn.net/qq_53376718/article/details/140706277