今天在用sklearn做机器学习的时候发现sklearn有个解决样本不平衡问题的好工具,于是乎,题主便迫不急待地去pip了。BUT, 安装快完成的时候报了这个错:
Failed to build scipy
Installing collected packages: scipy, scikit-learn, numpy, imbalanced-learn
Found existing installation: scipy 0.18.1
Uninstalling scipy-0.18.1:
Exception:
Traceback (most recent call last):
File "D:\Anaconda\lib\shutil.py", line 538, in move
os.rename(src, real_dst)
OSError: [WinError 17] 系统无法将文件移到不同的磁盘驱动器。: 'd:\\anaconda\\lib\
\site-packages\\scipy' -> 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-lm7lxb
wq-uninstall\\anaconda\\lib\\site-packages\\scipy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\Anaconda\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "D:\Anaconda\lib\site-packages\pip\commands\install.py", line 317, in run
prefix=options.prefix_path,
File "D:\Anaconda\lib\site-packages\pip\req\req_set.py", line 736, in install
requirement.uninstall(auto_confirm=True)
File "D:\Anaconda\lib\site-packages\pip\req\req_install.py", line 742, in unin
stall
paths_to_remove.remove(auto_confirm)
File "D:\Anaconda\lib\site-packages\pip\req\req_uninstall.py", line 115, in re
move
renames(path, new_path)
File "D:\Anaconda\lib\site-packages\pip\utils\__init__.py", line 267, in renam
es
shutil.move(old, new)
File "D:\Anaconda\lib\shutil.py", line 550, in move
rmtree(src)
File "D:\Anaconda\lib\shutil.py", line 488, in rmtree
return _rmtree_unsafe(path, onerror)
File "D:\Anaconda\lib\shutil.py", line 378, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "D:\Anaconda\lib\shutil.py", line 383, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "D:\Anaconda\lib\shutil.py", line 381, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] 拒绝访问。: 'd:\\anaconda\\lib\\site-packages\\scipy\\integrate\\lsoda.cp35-win_amd64.pyd'
PermissionError!PermissionError!PermissionError!
赶紧上 全球最大同性交友互助社区 找解决方案……
果然有答案了
参考第二楼,使用
pip install --user package_name
就可以完美解决这个问题,imbalanced-learn 模块安装ok!
C:\Users\Administrator>pip install --user imbalanced-learn
Collecting imbalanced-learn
Requirement already satisfied (use --upgrade to upgrade): scikit-learn>=0.17.1 i
n d:\anaconda\lib\site-packages (from imbalanced-learn)
Requirement already satisfied (use --upgrade to upgrade): scipy>=0.17.0 in d:\an
aconda\lib\site-packages (from imbalanced-learn)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.10.4 in d:\an
aconda\lib\site-packages (from imbalanced-learn)
Installing collected packages: imbalanced-learn
Successfully installed imbalanced-learn-0.2.1