簡體   English   中英

使用pip安裝flask時獲得權限被拒絕錯誤

[英]Getting a permission denied error when installing flask with pip

我試圖在Arch Linux上運行pip install flask ,我收到以下錯誤:

Collecting itsdangerous>=0.24 (from flask)
  Using cached https://files.pythonhosted.org/packages/dc/b4/a60bcdba945c00f6d608d8975131ab3f25b22f2bcfe1dab221165194b2d4/itsdangerous-0.24.tar.gz
Collecting MarkupSafe>=0.23 (from Jinja2>=2.10->flask)
  Using cached https://files.pythonhosted.org/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz
Installing collected packages: Werkzeug, click, MarkupSafe, Jinja2, itsdangerous, flask
  Running setup.py install for MarkupSafe ... done
  Running setup.py install for itsdangerous ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9u23zlnf/itsdangerous/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-r51zrnnv-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib
    copying itsdangerous.py -> build/lib
    running install_lib
    copying build/lib/itsdangerous.py -> /usr/lib/python3.6/site-packages
    byte-compiling /usr/lib/python3.6/site-packages/itsdangerous.py to itsdangerous.cpython-36.pyc
    error: [Errno 13] Permission denied: '/usr/lib/python3.6/site-packages/__pycache__/itsdangerous.cpython-36.pyc.140591598548528'

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9u23zlnf/itsdangerous/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-r51zrnnv-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9u23zlnf/itsdangerous/
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.`

這個錯誤是什么意思?

采用

pip install --user flask

代替。

您將收到“權限被拒絕”錯誤,這意味着您無權寫入特定位置。

當你使用pip install flaskpip將嘗試在/usr/lib/python3.6/../ flask某處安裝包裝/usr/lib/python3.6/../ 這個目錄需要root訪問權限,當你運行pip install flask時你沒有。

通過使用--user標志,您告訴pip將軟件包安裝到您的主目錄,該目錄不需要root權限。

使用--user標志安裝Python軟件包始終是一個好習慣,因為您不是在系統范圍內安裝該軟件包。 當您使用sudo pip install package_name您將在系統范圍內安裝/升級包(具有依賴項)。 Python在一些系統中啟動關鍵系統組件,迫使系統安裝新版本的軟件包可能會破壞一些關鍵的系統組件。 通常,系統只是為了支持向后兼容而停留在特定的軟件包版本上,如果您嘗試將其安裝為sudo,可能會破壞它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM