2014-09-07 44 views
9

Tôi đã cài đặt Python 3.4.1 trên Windows 7, bao gồm pip và trong khi cài đặt đã chọn thêm python.exe vào PATH.pip yêu cầu cài đặt ngoại lệ và pip cài đặt beautifulsoup4 ngoại lệ

Khi chạy pip cài đặt yêu cầu tôi nhận được:

C:\Python34>pip install requests 
Requirement already satisfied (use --upgrade to upgrade): requests in c:\python3 
4\lib\site-packages 
Cleaning up... 
    Exception: 
Traceback (most recent call last): 
    File "C:\Python34\lib\shutil.py", line 370, in _rmtree_unsafe 
    os.unlink(fullname) 
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\User\\AppData\\Local 
\\Temp\\pip_build_User\\pip\\pip\\_vendor\\distlib\\w32.exe' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "C:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "C:\Python34\lib\site-packages\pip\commands\install.py", line 302, in run 

    requirement_set.cleanup_files(bundle=self.bundle) 
    File "C:\Python34\lib\site-packages\pip\req.py", line 1333, in cleanup_files 
    rmtree(dir) 
    File "C:\Python34\lib\site-packages\pip\util.py", line 43, in rmtree 
    onerror=rmtree_errorhandler) 
    File "C:\Python34\lib\shutil.py", line 477, in rmtree 
    return _rmtree_unsafe(path, onerror) 
    File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe 
    _rmtree_unsafe(fullname, onerror) 
    File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe 
    _rmtree_unsafe(fullname, onerror) 
    File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe 
    _rmtree_unsafe(fullname, onerror) 
    File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe 
    _rmtree_unsafe(fullname, onerror) 
    File "C:\Python34\lib\shutil.py", line 372, in _rmtree_unsafe 
    onerror(os.unlink, fullname, sys.exc_info()) 
    File "C:\Python34\lib\site-packages\pip\util.py", line 53, in rmtree_errorhand 
ler 
    (exctype is PermissionError and value.args[3] == 5) #python3.3 
IndexError: tuple index out of range 

    Storing debug log for failure in C:\Users\User\pip\pip.log 

Khi chạy pip cài đặt beautifulsoup4 tôi nhận được:

C:\Python34>pip install beautifulsoup4 
Downloading/unpacking beautifulsoup4 
    Running setup.py (path:C:\Users\User\AppData\Local\Temp\pip_build_User\beautif 
ulsoup4\setup.py) egg_info for package beautifulsoup4 

Installing collected packages: beautifulsoup4 
    Running setup.py install for beautifulsoup4 
    Skipping implicit fixer: buffer 
    Skipping implicit fixer: idioms 
    Skipping implicit fixer: set_literal 
    Skipping implicit fixer: ws_comma 

Successfully installed beautifulsoup4 
Cleaning up... 
    Exception: 
Traceback (most recent call last): 
    File "C:\Python34\lib\shutil.py", line 370, in _rmtree_unsafe 
    os.unlink(fullname) 
PermissionError: [WinError 5] Access is denied: 'C:\\Users\\User\\AppData\\Local 
\\Temp\\pip_build_User\\pip\\pip\\_vendor\\distlib\\w32.exe' 

During handling of the above exception, another exception occurred: 

Traceback (most recent call last): 
    File "C:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "C:\Python34\lib\site-packages\pip\commands\install.py", line 302, in run 

    requirement_set.cleanup_files(bundle=self.bundle) 
    File "C:\Python34\lib\site-packages\pip\req.py", line 1333, in cleanup_files 
    rmtree(dir) 
    File "C:\Python34\lib\site-packages\pip\util.py", line 43, in rmtree 
    onerror=rmtree_errorhandler) 
    File "C:\Python34\lib\shutil.py", line 477, in rmtree 
    return _rmtree_unsafe(path, onerror) 
    File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe 
    _rmtree_unsafe(fullname, onerror) 
    File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe 
    _rmtree_unsafe(fullname, onerror) 
    File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe 
    _rmtree_unsafe(fullname, onerror) 
    File "C:\Python34\lib\shutil.py", line 367, in _rmtree_unsafe 
    _rmtree_unsafe(fullname, onerror) 
    File "C:\Python34\lib\shutil.py", line 372, in _rmtree_unsafe 
    onerror(os.unlink, fullname, sys.exc_info()) 
    File "C:\Python34\lib\site-packages\pip\util.py", line 53, in rmtree_errorhand 
ler 
    (exctype is PermissionError and value.args[3] == 5) #python3.3 
IndexError: tuple index out of range 

    Storing debug log for failure in C:\Users\User\pip\pip.log 

C:\Python34> 

tôi tự hỏi những gì những trường hợp ngoại lệ nghĩa là gì?

Có các gói thực sự được cài đặt thành công như được đưa ra trong nhật ký và chúng sẽ chạy tốt hay tôi đang làm gì đó sai.

Tại sao các trường hợp ngoại lệ và làm cách nào để loại bỏ chúng?

+0

Cài đặt BeautifulSoup là một Pita, bất kể phiên bản là ... Nhưng trong bối cảnh đặc biệt này, mà có thể không là vấn đề. Giao diện điều khiển có chạy với các đặc quyền quản trị không? – BartoszKP

+0

@BartoszKPc Cá nhân tôi không có vấn đề cài đặt bs4 với pip trên Windows. – tyteen4a03

+0

Có, không chạy cmd là admin là vấn đề. Cảm ơn bạn. – lowtechsun

Trả lời

8

Tất cả các trường hợp ngoại lệ cho phép có nghĩa là dấu nhắc lệnh của bạn không có quyền quản trị.

Chạy lời nhắc lệnh với tư cách Quản trị viên (tìm kiếm cmd trong menu bắt đầu, nhấp chuột phải, Chạy với tư cách Quản trị viên). Nếu điều đó không hoạt động, hãy thử cài đặt lại pip; các điều khoản cho phép mọi thứ có thể đã bị bóp méo bằng cách nào đó.

+2

Chạy cmd là quản trị viên và không có ngoại lệ trong cả hai trường hợp. Cảm ơn bạn. – lowtechsun

+2

Cảm ơn giải pháp này ... Đã bị kẹt nặng do vấn đề quyền. 1 cho điều đó .. – Zax