[英]Python: permission denied error when installing pip
我是一名學生,我正在部門計算機上做項目,系統 Linux 7.2。 現在我正在嘗試安裝 pip 以便我可以使用它安裝 python 包。
我已經下載了get-pip.py
並嘗試通過python get-pip.py
安裝。 它給了我:
Collecting pip
Downloading pip-8.1.1-py2.py3-none-any.whl (1.2MB)
100% |████████████████████████████████| 1.2MB 471kB/s
Collecting wheel
Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
100% |████████████████████████████████| 71kB 764kB/s
Installing collected packages: pip, wheel
Exception:
Traceback (most recent call last):
File "/tmp/tmpqybTwL/pip.zip/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/tmp/tmpqybTwL/pip.zip/pip/commands/install.py", line 317, in run
prefix=options.prefix_path,
File "/tmp/tmpqybTwL/pip.zip/pip/req/req_set.py", line 732, in install
**kwargs
File "/tmp/tmpqybTwL/pip.zip/pip/req/req_install.py", line 835, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/tmp/tmpqybTwL/pip.zip/pip/req/req_install.py", line 1030, in move_wheel_files
isolated=self.isolated,
File "/tmp/tmpqybTwL/pip.zip/pip/wheel.py", line 344, in move_wheel_files
clobber(source, lib_dir, True)
File "/tmp/tmpqybTwL/pip.zip/pip/wheel.py", line 315, in clobber
ensure_dir(destdir)
File "/tmp/tmpqybTwL/pip.zip/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib64/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/lib/python2.7/site-packages/pip'
然后,我嘗試使用sudo python get-pip.py
進行安裝,但是,我得到"xxx is not in the sudoers file. This incident will be reported."
所以,我想知道我是否沒有 root 權限並且沒有權限執行 sudo ......但我不確定這個......
有什么建議可以解決這個問題嗎? 最后,我想安裝scipy
和gensim
。
您需要使用虛擬環境,並在虛擬環境中安裝 pip 包。 或者使用 pip 全局安裝它,即系統范圍內的 root 用戶
嘗試使用 easy_install 安裝 pip 在終端中嘗試以下命令:
sudo su
easy_install pip
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.