2017-09-24 92 views
-1

我在python 3.6版本中安裝請求模塊時遇到了一些錯誤和異常。 我附上了我正面臨的錯誤的截圖。 click here for error screenshot在python 3.6中安裝請求模塊的錯誤

這裏是我事先

在CMD窗口拿到

C:\Program Files (x86)\Python36-32\Scripts>pip3 install requests 
Collecting requests 
    Using cached requests-2.18.4-py2.py3-none-any.whl 
Collecting certifi>=2017.4.17 (from requests) 
    Using cached certifi-2017.7.27.1-py2.py3-none-any.whl 
Collecting urllib3<1.23,>=1.21.1 (from requests) 
    Using cached urllib3-1.22-py2.py3-none-any.whl 
Collecting idna<2.7,>=2.5 (from requests) 
    Using cached idna-2.6-py2.py3-none-any.whl 
Collecting chardet<3.1.0,>=3.0.2 (from requests) 
    Using cached chardet-3.0.4-py2.py3-none-any.whl 
Installing collected packages: certifi, urllib3, idna, chardet, requests 
Exception: 
Traceback (most recent call last): 
    File "c:\program files (x86)\python36-32\lib\site-packages\pip\basecommand.py" 
, line 215, in main 
    status = self.run(options, args) 
    File "c:\program files (x86)\python36-32\lib\site-packages\pip\commands\instal 
l.py", line 342, in run 
    prefix=options.prefix_path, 
    File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_set.py" 
, line 784, in install 
    **kwargs 
    File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install 
.py", line 851, in install 
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix) 
    File "c:\program files (x86)\python36-32\lib\site-packages\pip\req\req_install 
.py", line 1064, in move_wheel_files 
    isolated=self.isolated, 
    File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 
345, in move_wheel_files 
    clobber(source, lib_dir, True) 
    File "c:\program files (x86)\python36-32\lib\site-packages\pip\wheel.py", line 
316, in clobber 
    ensure_dir(destdir) 
    File "c:\program files (x86)\python36-32\lib\site-packages\pip\utils\__init__. 
py", line 83, in ensure_dir 
    os.makedirs(path) 
    File "c:\program files (x86)\python36-32\lib\os.py", line 220, in makedirs 
    mkdir(name, mode) 
PermissionError: [WinError 5] Access is denied: 'c:\\program files (x86)\\python 
36-32\\Lib\\site-packages\\certifi' 

感謝

+0

請考慮提供[MCVE],以便人們可以幫助 –

+0

請求文檔建議使用[Pipenv](https://pipenv.readthedocs.io/en/latest/)來安裝模塊。也許你應該試試看?另外,爲了將來的參考,您可以使用[alt] + [打印屏幕]截取活動窗口的截圖,因此您不必模糊其他所有內容。 –

回答

1

,你所面臨的是由於權限錯誤問題的錯誤。這很可能是因爲您沒有以管理員身份運行命令行提示符。因此,最好的方法是右鍵單擊命令行圖標,然後以管理員身份運行。完成之後,請繼續正常操作並使用pip install requests安裝請求。通常,當您嘗試在主python安裝中安裝python軟件包時,會發生此錯誤,因爲您需要管理員權限才能寫入Program Files中的任何內容。

這應該解決問題。但是,更好的選擇是安裝virtualenv軟件包,然後進行本地化的軟件包安裝,以便您可以避免這些需要特殊權限的混亂安裝。

+0

它正在工作謝謝@Games Brainiac –