我做了一个全新的Windows 10安装,安装了python,cygwin和一个名为ConEmu的改进控制台。安装python 3.4.3后,执行:
class ByValue implements Comparator<Map.Entry<String, Integer>>
得到了这个错误。
pip install -U pip
我已使用预定义的管理员帐户登录,并且临时目录以及Python的安装目录(C:\ Anwendungsentwicklung \ Python34)具有完全访问权限。
请通过设置不同的权限测试所有版本,但Windows不允许我这样做。我甚至添加了#34;每个人&#34;安全选项卡,但这并没有帮助,虽然我记得它与Windows 7一起使用这个&#34;技巧&#34;。它一定是Windows 10的问题。有人可以帮忙吗?
这是完全追溯
File "C:\Anwendungsentwicklung\Python34\lib\site-packages\pip\utils\__init__.py", line 70, in rmtree_errorhandler
os.makedirs(path)
PermissionError: [WinError 5] Zugriff verweigert: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-dxm8d3xg-uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe'
现在我在&#34; c:\ anwendungsentwicklung \ python34 \ lib \ shutil.py&#34;中添加了一个断点:
Exception:
Traceback (most recent call last):
File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 372, in _rmtree_unsafe
os.unlink(fullname)
PermissionError: [WinError 5] Zugriff verweigert: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-k7g0hd6t- uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\basecommand.py", line 232, in main
logger.critical('Operation cancelled by user')
File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\commands\install.py", line 347, in run
ensure_dir(options.target_dir)
File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\req\req_set.py", line 560, in install
missing_requested = sorted(
File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\req\req_install.py", line 677, in commit_uninstall
logger.debug(
File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\req\req_uninstall.py", line 153, in commit
self.save_dir = None
File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\utils\__init__.py", line 58, in rmtree
SUPPORTED_EXTENSIONS = ZIP_EXTENSIONS + TAR_EXTENSIONS
File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 484, in rmtree
return _rmtree_unsafe(path, onerror)
File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 368, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 368, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 368, in _rmtree_unsafe
_rmtree_unsafe(fullname, onerror)
File "c:\anwendungsentwicklung\python34\lib\shutil.py", line 376, in _rmtree_unsafe
print(fullname)
File "c:\anwendungsentwicklung\python34\lib\site-packages\pip\utils\__init__.py", line 70, in rmtree_errorhandler
try:
PermissionError: [WinError 5] Zugriff verweigert: 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-k7g0hd6t-uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe'
当我执行
时# version vulnerable to race conditions
def _rmtree_unsafe(path, onerror):
try:
if os.path.islink(path):
# symlinks to directories are forbidden, see bug #1669
raise OSError("Cannot call rmtree on a symbolic link")
except OSError:
onerror(os.path.islink, path, sys.exc_info())
# can't continue even if onerror hook returns
return
names = []
try:
names = os.listdir(path)
except OSError:
onerror(os.listdir, path, sys.exc_info())
for name in names:
fullname = os.path.join(path, name)
try:
mode = os.lstat(fullname).st_mode
except OSError:
mode = 0
if stat.S_ISDIR(mode):
_rmtree_unsafe(fullname, onerror)
else:
try:
#import pdb
os.unlink(fullname)
#pdb.set_trace()
except OSError:
import pdb; pdb.set_trace()
print(fullname)
import getpass
print(getpass.getuser())
onerror(os.unlink, fullname, sys.exc_info())
try:
os.rmdir(path)
except OSError:
onerror(os.rmdir, path, sys.exc_info())
我得到了这个os.unlink(fullname) # 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-k7g0hd6t- uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe'
,所以我用
PermissionError
然后返回:&#39; 0o100777&#39;
当我说得对,这意味着每个人(所有者,团体和其他人)的完全许可。
我很沮丧:/ 有人有想法吗?
答案 0 :(得分:7)
正如here所述,这是Windows限制。简而言之,pip.exe文件正在使用中,因此被锁定且无法删除。使用python -m pip install --upgrade pip
。
答案 1 :(得分:4)
我在相同情况下的首选是使用管理员权限启动控制台。您可以从开始菜单执行此操作,或者如果您使用的是ConEmu / Cmder,只需以管理员身份运行新的实例/选项卡。
答案 2 :(得分:0)
我遇到了同样的问题。如果您通过右键单击“以管理员身份”运行cmd,它会起作用。
答案 3 :(得分:0)
尝试使用此
python -m pip install --user --upgrade pip