无法使用sudo在centOs上运行pip3 7

问题描述:

我有一个问题。当我在没有sodo的情况下在centos 7上运行pip3 commnad时,它可以正常工作。所以pip3 --version outpus这无法使用sudo在centOs上运行pip3 7

pip 9.0.1 from /root/projects/venv/lib/python3.6/site-packages (python 3.6) 

,但是当我有这样的sudo pip3 --version须藤运行它,我得到命令未找到错误。

sudo: pip3: command not found 

有人可以帮我吗?我想安装uswgi,当我不使用sudo时安装会终止。这是错误

compilation terminated. 

---------------------------------------- 
Command "/root/projects/venv/bin/python3.6 -u -c "import setuptools, 
tokenize;__file__='/tmp/pip-build- 
2usl184a/uwsgi/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-gv2qp3l0-record/install-record.txt --single-version- 
externally-managed --compile --install-headers 
/root/projects/venv/include/site/python3.6/uwsgi" failed with error 
code 1 in /tmp/pip-build-2usl184a/uwsgi/ 

试试这个:

sudo yum install python34-setuptools 
sudo easy_install pip 
+0

这个作品!你能解释发生了什么,为什么这能解决问题? – Reza

+0

您可能在用户配置文件上安装了pip,但未将其安装到root用户,因此sudo(root)没有命令pip。以这种方式安装它将为root用户安装。 –