DEV Community

Discussion on: Dead Simple Python: Virtual Environments and pip

Collapse
 
jcsvveiga profile image
João Veiga

It's not exactly wrong, it might not do what you are expecting.
People might run pip install requests and fail because of permissions. They might try sudo pip instead of pip install --user.

Sudo pip will install things in the system's python, rather than the user's python.

Collapse
 
imronlearning profile image
Michael Learns

Ah! That makes sense. So it would be much better then to do pip install --user than sudo?

Thread Thread
 
jcsvveiga profile image
João Veiga

Yes, or if you want a ditectory/project dependencies, use a virtual environment

Collapse
 
codemouse92 profile image
Jason C. McDonald

Good explanation, @jcsvveiga .

The reason I say you should "never" use sudo pip is, on any system maintained by a dedicated package manager, it can easily conflict with the system-maintained packages, which can make a real mess, especially where dependencies are concerned.