沒權限的安裝模塊方法


當你不是root用戶時,安裝模塊時報錯:

$ pip install Cmake
...
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/lib64/python2.7/site-packages/cmake-3.14.4.dist-info'
Consider using the `--user` option or check the permissions.

因為代表進行全局安裝,安裝后全局可用

解決辦法就是:

$ pip install --user Cmake
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting Cmake
  Using cached https://files.pythonhosted.org/packages/09/bb/0121c0ae40144b99420a1a0ea081d48ac4d77332600896d7e04bf23aa957/cmake-3.14.4-py2-none-manylinux2010_x86_64.whl
Installing collected packages: Cmake
Successfully installed Cmake-3.14.4

添加一個--user,代表僅該用戶的安裝,安裝后僅該用戶可用。處於安全考慮,盡量使用該命令進行安裝。

記得卸載的時候也要添加 --user

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM