2015-08-20 19 views
5

Tôi đã cài đặt Windows 10 mới, cài đặt python, cygwin và bảng điều khiển cải tiến có tên ConEmu. Sau khi cài đặt trăn 3.4.3, tôi thực hiện:Windows 10 và nâng cấp pip - Truy cập bị từ chối

pip install -U pip 

Và gặp lỗi này.

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' 

Tôi đang đăng nhập với tài khoản quản trị được xác định trước và các thư mục temp cũng như dir lắp đặt Python (C: \ Anwendungsentwicklung \ Python34) có quyền truy cập đầy đủ.

Vui lòng thử nghiệm tất cả các biến thể bằng cách đặt các quyền khác nhau nhưng Windows sẽ không cho phép tôi. Tôi thậm chí còn thêm "Mọi người" vào tab bảo mật nhưng điều này đã không giúp mặc dù tôi nhớ nó đã làm việc với Windows 7 với "lừa" này. Nó phải là một vấn đề với Windows 10. Ai đó có thể giúp đỡ ??

enter image description here


này là đầy đủ traceback

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' 

Bây giờ tôi đã thêm một breakpoint trong "c: \ anwendungsentwicklung \ python34 \ lib \ shutil.py":

# 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()) 

Khi tôi thực hiện

os.unlink(fullname) # 'C:\\Users\\ADMINI~1\\AppData\\Local\\Temp\\pip-k7g0hd6t- uninstall\\anwendungsentwicklung\\python34\\scripts\\pip.exe' 

tôi nhận được PermissionError này, vì vậy tôi đã kiểm tra các quyền của tập tin .exe này với

oct(os.stat(fullname)[ST_MODE]) 

và nó sẽ trả về: '0o100777'

Và khi tôi là đúng, điều này có nghĩa cho phép đầy đủ cho mọi người (chủ sở hữu, nhóm và những người khác).

Tôi thất vọng:/ Ai đó là một ý tưởng?

+0

Bạn đã thử chạy lệnh trong khi được nâng lên chưa? – poke

+0

Đây không phải là giao diện điều khiển ConEmu của bạn - Tôi vừa nâng cấp và gặp lỗi tương tự bằng giao diện điều khiển Cygwin chuẩn. –

+0

@poke chắc chắn. Nhưng giống như Thane Plummer nói, điều đó không quan trọng cái bàn điều khiển nào. Windows 10 có cái gì đó thường bị crapped -.- – FalloutBoy

Trả lời

4

Như đã thảo luận here, đó là giới hạn của Windows. Tóm lại, tệp pip.exe đang được sử dụng và do đó bị khóa và không thể bị xóa. Sử dụng python -m pip install --upgrade pip.

+0

Vui lòng cung cấp thêm thông tin bằng cách * chỉnh sửa câu hỏi của bạn * thay vì thêm nó làm câu trả lời (không phải là câu trả lời). –

+0

@Roland Smith thấy rằng trong các chủ đề khác, xin lỗi. Giải quyết vấn đề cho tôi. Đó là một giới hạn cửa sổ và chưa được khắc phục. Sử dụng python -m pip install --upgrade pip. Thảo luận tại đây: https://github.com/pypa/pip/issues/1299 Tóm tắt: Tệp bị khóa/đang sử dụng và không thể xóa các tệp đó. Cảm ơn tất cả! – FalloutBoy

+0

Bạn nên thực hiện * đó * một câu trả lời và chấp nhận nó. –

4

Lựa chọn đầu tiên của tôi trong cùng tình huống là bắt đầu giao diện điều khiển với quyền của quản trị viên. Bạn có thể làm điều đó từ trình đơn bắt đầu hoặc nếu bạn đang sử dụng ConEmu/Cmder, chỉ cần chạy cá thể/tab mới làm quản trị viên.

+0

Chỉ cần làm rõ: mở menu bắt đầu, nhấp chuột phải vào 'command prompt', chọn 'more', bấm 'Run as administrator'. –

+0

Cảm ơn. Điều này đã giúp! –

Các vấn đề liên quan