[英]What is the difference between pip install and sudo pip install?
I tried installing Flask and a few packages using sudo in a virtual environment, but on trying to import Flask, it'll throw up an ImportError. 我尝试在虚拟环境中使用sudo安装Flask和一些软件包,但是在尝试导入Flask时,会抛出ImportError。 On installing the same packages with pip install
though it works fine. 使用pip install
相同的软件包时,尽管效果很好。 So what's the difference between these methods? 那么这些方法有什么区别? I tried this on Ubuntu. 我在Ubuntu上尝试过。
Also, where does pip install these packages? 另外,pip在哪里安装这些软件包? Looking through Stack Overflow I could only find questions that answer how to list packages installed by pip, but not where to find them (in context to the virtual environment) 通过Stack Overflow查看,我只能找到回答如何列出pip安装的软件包的问题,而不能找到在哪里找到它们的问题(在虚拟环境中)
pip install
Will run pip install
as the current user 将以当前用户身份运行pip install
sudo pip install
Will run pip install
with the security privileges of another user, root
for example. 将使用其他用户(例如root
的安全特权运行pip install
。
You normally need to use sudo
to install a package on a system. 通常,您需要使用sudo
在系统上安装软件包。
You may want to read linux-101-introduction-to-sudo 您可能需要阅读linux-101-introduction-to-sudo
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.