我在Windows上安装Keras时获得PermissionError
。这是控制台日志:
(base) C:\Users\nEW u>pip install --upgrade keras
Collecting keras
Using cached Keras-2.1.5-py2.py3-none-any.whl
Collecting scipy>=0.14 (from keras)
Using cached scipy-1.0.1-cp36-none-win_amd64.whl
Requirement already up-to-date: pyyaml in e:\anaconda\lib\site-packages (from keras)
Requirement already up-to-date: six>=1.9.0 in e:\anaconda\lib\site-packages
(from keras)
Collecting numpy>=1.9.1 (from keras)
Using cached numpy-1.14.2-cp36-none-win_amd64.whl
Installing collected packages: numpy, scipy, keras
Found existing installation: numpy 1.13.3
Uninstalling numpy-1.13.3:
Exception:
Traceback (most recent call last):
File "e:\anaconda\lib\shutil.py", line 544, in move
os.rename(src, real_dst)
OSError: [WinError 17] The system cannot move the file to a different disk
drive: 'e:\\anaconda\\lib\\site-packages\\numpy' ->
'C:\\Users\\NEWU~1\\AppData\\Local\\Temp\\pip-h2l8dzqf-
uninstall\\anaconda\\lib\\site-packages\\numpy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "e:\anaconda\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "e:\anaconda\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "e:\anaconda\lib\site-packages\pip\req\req_set.py", line 778, in install
requirement.uninstall(auto_confirm=True)
File "e:\anaconda\lib\site-packages\pip\req\req_install.py", line 754, in
uninstall
paths_to_remove.remove(auto_confirm)
File "e:\anaconda\lib\site-packages\pip\req\req_uninstall.py", line 115, in
remove
renames(path, new_path)
File "e:\anaconda\lib\site-packages\pip\utils\__init__.py", line 267, in
renames
shutil.move(old, new)
File "e:\anaconda\lib\shutil.py", line 556, in move
rmtree(src)
File "e:\anaconda\lib\shutil.py", line 494, in rmtree
return _rmtree_unsafe(path, onerror)
File "e:\anaconda\lib\shutil.py", line 384, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "e:\anaconda\lib\shutil.py", line 389, in _rmtree_unsafe
onerror(os.unlink, fullname, sys.exc_info())
File "e:\anaconda\lib\shutil.py", line 387, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Access is denied: 'e:\\anaconda\\lib\\site-packages\\numpy\\core\\multiarray.cp36-win_amd64.pyd'
答案 0 :(得分:0)
您需要在管理员中运行命令行才能访问这些目录。它在另一篇文章中得到了回答:
希望它有效。