Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • Because the /usr/local folder is owned by root. You aren't allowed to change it. As a rule, I tend to install most packages with sudo, just so they're available everywhere. Commented Jul 15, 2021 at 19:55
  • In general, /usr/local is a root owned area. It is better to keep permissions strict because you install a lot less frequently than you run. If you are using a system-wide python that all users can use, then it makes sense not to allow users to install whatever package they want. Any user can install packages / libraries locally with user. All that being said, it is fine to upgrade pip with sudo.
    – d_kennetz
    Commented Jul 15, 2021 at 19:56
  • What installed pip under /usr/local/opt in the first place? That's the only thing that should be upgrading pip. If you want a more up-to-date version without touching /usr/local/opt, create a virtual environment first.
    – chepner
    Commented Jul 15, 2021 at 20:01
  • pip is not part of the standard Python distribution; it's a 3rd-party tool that some particular distribution installed along with Python.
    – chepner
    Commented Jul 15, 2021 at 20:08
  • Did the Python you're using come with your distro? In particular is pip a package in your package manager? If so, upgrade pip using the package manager. (The upgrade might not be available right away through that channel, though. Alternatively, uninstall that and install pip using python -m ensurepip
    – kindall
    Commented Jul 15, 2021 at 21:26