python安装sklearn模块_python sklearn找不到指定模块

5e99067c19cfa656.jpg

在 import sklearn.manifold时出现 ImportError: DLL load failed:找不到指定的模块,具体如下:Traceback (most recent call last):

File "", line 1, in

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagessklearnmanifold\__init__.py", line 5, in

from .locally_linear import locally_linear_embedding, LocallyLinearEmbedding

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagessklearnmanifoldlocally_linear.py", line 17, in

from ..neighbors import NearestNeighbors

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagessklearn

eighbors\__init__.py", line 9, in

from .graph import kneighbors_graph, radius_neighbors_graph

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagessklearn

eighborsgraph.py", line 7, in

from .base import KNeighborsMixin, RadiusNeighborsMixin

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagessklearn

eighborsase.py", line 18, in

from ..metrics import pairwise_distances

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagessklearnmetrics\__init__.py", line 35, in

from . import cluster

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagessklearnmetricscluster\__init__.py", line 20, in

from .unsupervised import silhouette_samples

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagessklearnmetricsclusterunsupervised.py", line 12, in

from ..pairwise import pairwise_distances

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagessklearnmetricspairwise.py", line 30, in

from .pairwise_fast import _chi2_kernel_fast, _sparse_manhattan

ImportError: DLL load failed: 找不到指定的模块。

解决方法:

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

若遇到如下问题:Exception:

Traceback (most recent call last):

File "C:UsersuserAppDataLocalProgramsPythonPython36libshutil.py", line 387, in _rmtree_unsafe

os.unlink(fullname)

PermissionError: [WinError 5] 拒绝访问。: 'C:UsersuserAppDataLocalTemppip-njirl_1q-uninstallusersuserappdatalocalprogramspythonpython36libsite-packagessklearnfeature_extraction\_hashing.cp36-win_amd64.pyd'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespipasecommand.py", line 215, in main

status = self.run(options, args)

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespipcommandsinstall.py", line 342, in run

prefix=options.prefix_path,

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespipeqeq_set.py", line 795, in install

requirement.commit_uninstall()

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespipeqeq_install.py", line 767, in commit_uninstall

self.uninstalled.commit()

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespipeqeq_uninstall.py", line 142, in commit

rmtree(self.save_dir)

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespip\_vendoretrying.py", line 49, in wrapped_f

return Retrying(*dargs, **dkw).call(f, *args, **kw)

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespip\_vendoretrying.py", line 212, in call

raise attempt.get()

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespip\_vendoretrying.py", line 247, in get

six.reraise(self.value[0], self.value[1], self.value[2])

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespip\_vendorsix.py", line 686, in reraise

raise value

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespip\_vendoretrying.py", line 200, in call

attempt = Attempt(fn(*args, **kwargs), attempt_number, False)

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespiputils\__init__.py", line 102, in rmtree

οnerrοr=rmtree_errorhandler)

File "C:UsersuserAppDataLocalProgramsPythonPython36libshutil.py", line 494, in rmtree

return _rmtree_unsafe(path, onerror)

File "C:UsersuserAppDataLocalProgramsPythonPython36libshutil.py", line 384, in _rmtree_unsafe

_rmtree_unsafe(fullname, onerror)

File "C:UsersuserAppDataLocalProgramsPythonPython36libshutil.py", line 384, in _rmtree_unsafe

_rmtree_unsafe(fullname, onerror)

File "C:UsersuserAppDataLocalProgramsPythonPython36libshutil.py", line 384, in _rmtree_unsafe

_rmtree_unsafe(fullname, onerror)

[Previous line repeated 7 more times]

File "C:UsersuserAppDataLocalProgramsPythonPython36libshutil.py", line 389, in _rmtree_unsafe

onerror(os.unlink, fullname, sys.exc_info())

File "C:UsersuserAppDataLocalProgramsPythonPython36libsite-packagespiputils\__init__.py", line 114, in rmtree_errorhandler

func(path)

PermissionError: [WinError 5] 拒绝访问。: 'C:UsersuserAppDataLocalTemppip-njirl_1q-uninstallusersuserappdatalocalprogramspythonpython36libsite-packagessklearnfeature_extraction\_hashing.cp36-win_amd64.pyd'

使用 pip install --user package_name命令即可解决。

更多Python知识请关注云海天Python教程栏目。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值