python sklearn找不到指定模块

图片[1]-python sklearn找不到指定模块-uusu优素-乐高,模型,3d打印,编程

在 import sklearn.manifold时出现ImportError: DLL load failed:找不到指定的模块,具体如下:

Traceback(mostrecentcalllast):
File"<stdin>",line1,in<module>
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\manifold\__init__.py",line5,in<module>
from.locally_linearimportlocally_linear_embedding,LocallyLinearEmbedding
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\manifold\locally_linear.py",line17,in<module>
from..neighborsimportNearestNeighbors
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\neighbors\__init__.py",line9,in<module>
from.graphimportkneighbors_graph,radius_neighbors_graph
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\neighbors\graph.py",line7,in<module>
from.baseimportKNeighborsMixin,RadiusNeighborsMixin
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\neighbors\base.py",line18,in<module>
from..metricsimportpairwise_distances
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\__init__.py",line35,in<module>
from.importcluster
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\cluster\__init__.py",line20,in<module>
from.unsupervisedimportsilhouette_samples
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\cluster\unsupervised.py",line12,in<module>
from..pairwiseimportpairwise_distances
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\sklearn\metrics\pairwise.py",line30,in<module>
from.pairwise_fastimport_chi2_kernel_fast,_sparse_manhattan
ImportError:DLLloadfailed:找不到指定的模块。

解决方法:

在保证scipy和numpy成功安装的条件下,并且安装了pip后使用命令 pip install -U scikit-learn 更新一下即可。

若遇到如下问题:

Exception:
Traceback(mostrecentcalllast):
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\shutil.py",line387,in_rmtree_unsafe
os.unlink(fullname)
PermissionError:[WinError5]拒绝访问。:'C:\\Users\\user\\AppData\\Local\\Temp\\pip-njirl_1q-uninstall\\users\\user\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\sklearn\\feature_extraction\\_hashing.cp36-win_amd64.pyd'

Duringhandlingoftheaboveexception,anotherexceptionoccurred:

Traceback(mostrecentcalllast):
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\basecommand.py",line215,inmain
status=self.run(options,args)
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\commands\install.py",line342,inrun
prefix=options.prefix_path,
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\req\req_set.py",line795,ininstall
requirement.commit_uninstall()
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\req\req_install.py",line767,incommit_uninstall
self.uninstalled.commit()
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\req\req_uninstall.py",line142,incommit
rmtree(self.save_dir)
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\retrying.py",line49,inwrapped_f
returnRetrying(*dargs,**dkw).call(f,*args,**kw)
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\retrying.py",line212,incall
raiseattempt.get()
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\retrying.py",line247,inget
six.reraise(self.value[0],self.value[1],self.value[2])
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\six.py",line686,inreraise
raisevalue
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\_vendor\retrying.py",line200,incall
attempt=Attempt(fn(*args,**kwargs),attempt_number,False)
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\utils\__init__.py",line102,inrmtree
οnerrοr=rmtree_errorhandler)
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\shutil.py",line494,inrmtree
return_rmtree_unsafe(path,onerror)
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\shutil.py",line384,in_rmtree_unsafe
_rmtree_unsafe(fullname,onerror)
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\shutil.py",line384,in_rmtree_unsafe
_rmtree_unsafe(fullname,onerror)
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\shutil.py",line384,in_rmtree_unsafe
_rmtree_unsafe(fullname,onerror)
[Previouslinerepeated7moretimes]
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\shutil.py",line389,in_rmtree_unsafe
onerror(os.unlink,fullname,sys.exc_info())
File"C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\pip\utils\__init__.py",line114,inrmtree_errorhandler
func(path)
PermissionError:[WinError5]拒绝访问。:'C:\\Users\\user\\AppData\\Local\\Temp\\pip-njirl_1q-uninstall\\users\\user\\appdata\\local\\programs\\python\\python36\\lib\\site-packages\\sklearn\\feature_extraction\\_hashing.cp36-win_amd64.pyd'

使用pipinstall–userpackage_name命令即可解决。

原文来自:https://www.py.cn
© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容