Determining whether a package or module should be installed globally using pip

Chris Angelico rosuav at gmail.com
Wed Apr 25 12:50:25 EDT 2018


On Thu, Apr 26, 2018 at 2:22 AM, Paul Moore <p.f.moore at gmail.com> wrote:
> On 25 April 2018 at 16:32, Rodrigo Acosta <rodacoram8 at gmail.com> wrote:
>> Is there a rule of thumb in deciding where to install a package? What makes a package, other than security vulnerabilities, better to install globally e.g. using sudo pip install, or by changing directory to tmp folder, or by using virtualenv?
>
> Generally, I would say you should *never* use "sudo pip install". The
> system installed Python is managed by your distribution package
> manager, and you should only ever make changes to that using vendor
> supplied packages ("apt-get install python-requests" or whatever the
> incantation might be).

This is the case if your Python was managed by your distribution. If
you've installed a different Python (maybe one you built from source),
then 'sudo python3 -m pip install' may be appropriate. But yes, for
the system Python, use the system package manager.

ChrisA



More information about the Python-list mailing list