1. 程式人生 > 程式設計 >三步解決python PermissionError: [WinError 5]拒絕訪問的情況

三步解決python PermissionError: [WinError 5]拒絕訪問的情況

問題描述:

1.當你解除安裝python庫的時候,如:pip uninstall pandas

2.當你想要更新python庫的時候,如:pip install --upgrade pandas

等等… 就會出現PermissionError: [WinError 5] 問題

廢話不多說,分三步完全解決該問題:

第一步:

關閉跟python相關的所有程式,如jupyter,pycharm,Anaconda等等,這一步非常重要!!!

好了,第一步完成下面開始常規操作的兩步:

第二步:

賦予使用者對python的“完全控制”的許可權,步驟如下:

找到按照python的位置,本文用的是Anaconda,安裝在D盤,位置為:D:\Anaconda3。找到python->右鍵->屬性->安全->點選“組或使用者名稱”中的Users->編輯->點選點選“組或使用者名稱”中的Users->把“完全控制”打鉤->應用->OK

三步解決python PermissionError: [WinError 5]拒絕訪問的情況

第三步:

執行完第二步一般就能解決問題。如果還沒解決問題的話,請執行第三部,找到你安裝python的資料夾,本人用的是Anaconda3,那麼就直接對該資料夾(本人安裝位置為D:\Anaconda3),右鍵屬性,按照第二步的方法執行一遍就OK了!

當然,如果你用的pycharm或其他軟體安裝的python,那麼就找到你安裝位置的那個資料夾,同理右鍵->屬性,執行第二步的方法, 搞定!

**總結:**一定要關閉所有跟python相關的程式!

補充知識:jupyter notebook_啟動出錯_ValueError: Please install nodejs 5+ and npm before continuing installation.

錯誤描述:

在啟動jupyter notebook的時候雖然能進入Home,但是後臺還是報錯,如下:

[W 11:03:21.011 NotebookApp] Error loading server extension jupyterlab
 Traceback (most recent call last):
 File "E:\Anaconda3\lib\site-packages\jupyterlab\commands.py",line 321,in
 __init__
 self._run(['node','node-version-check.js'],cwd=HERE,quiet=True)
 File "E:\Anaconda3\lib\site-packages\jupyterlab\commands.py",line 1165,i
n _run
 proc = Process(cmd,**kwargs)
 File "E:\Anaconda3\lib\site-packages\jupyterlab\process.py",line 73,in _
_init__
 self.proc = self._create_process(cwd=cwd,env=env)
 File "E:\Anaconda3\lib\site-packages\jupyterlab\process.py",line 131,in
_create_process
 cmd[0] = which(cmd[0],kwargs.get('env'))
 File "E:\Anaconda3\lib\site-packages\jupyterlab\jlpmapp.py",line 59,in w
hich
 raise ValueError(msg)
 ValueError: Please install nodejs 5+ and npm before continuing installation.
 nodejs may be installed using conda or directly from the nodejs website.
 
 During handling of the above exception,another exception occurred:
 
 Traceback (most recent call last):
 File "E:\Anaconda3\lib\site-packages\notebook\notebookapp.py",line 1454,in init_server_extensions
 func(self)
 File "E:\Anaconda3\lib\site-packages\jupyterlab\extension.py",line 111,i
n load_jupyter_server_extension
 info = get_app_info(app_dir)
 File "E:\Anaconda3\lib\site-packages\jupyterlab\commands.py",line 244,in
 get_app_info
 handler = _AppHandler(app_dir,logger)
 File "E:\Anaconda3\lib\site-packages\jupyterlab\commands.py",line 324,in
 __init__
 raise ValueError(msg)
 ValueError: Please install nodejs 5+ and npm before continuing installation.
 nodejs may be installed using conda or directly from the nodejs website.
[I 11:03:21.336 NotebookApp] Serving notebooks from local directory: C:\Users\Ad
ministrator\Desktop\shuju
[I 11:03:21.338 NotebookApp] 0 active kernels
[I 11:03:21.339 NotebookApp] The Jupyter Notebook is running at:
[I 11:03:21.340 NotebookApp] http://localhost:8888/?token=14172d7abed02b6a0b816a
51fa29f6b44929d2f96b8a1b7f
[I 11:03:21.342 NotebookApp] Use Control-C to stop this server and shut down all
 kernels (twice to skip confirmation).
[C 11:03:21.350 NotebookApp]
 
 Copy/paste this URL into your browser when you connect for the first time,to login with a token:
 http://localhost:8888/?token=14172d7abed02b6a0b816a51fa29f6b44929d2f96b8
a1b7f
[I 11:03:21.581 NotebookApp] Accepting one-time-token-authenticated connection f
rom ::1
[I 11:15:21.364 NotebookApp] Interrupted...
[I 11:15:21.366 NotebookApp] Shutting down 0 kernels

解決方案:

因為我的電腦上安裝了Anaconda,所以我開啟Anacoda後

三步解決python PermissionError: [WinError 5]拒絕訪問的情況

等待系統安裝,完成後在cmd命令列中再次輸入jupyter notebook,問題解決

三步解決python PermissionError: [WinError 5]拒絕訪問的情況

三步解決python PermissionError: [WinError 5]拒絕訪問的情況

以上這篇三步解決python PermissionError: [WinError 5]拒絕訪問的情況就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支援我們。