1

I am new at ubuntu and python too.

While installing different packaged through pip in ubuntu terminal it gives permission denied errors.Ex : pip3 install numpy

But when i run same command after running sudo su it works perfect.

What is this sudo su doing here? And when should i use that command?

What it exactly doing in general term?

3
  • it switches to super user - root. You'll notice # at the front instead $. It is used to escalate priviledges, which are required for certain tasks. kb.iu.edu/d/amyi
    – fugitive
    Apr 10, 2017 at 15:35
  • run using sudo pip3 install numpy, basically your current user is not having permissions to write to folders where this package will be installed. So, root privileges are required
    – luv.preet
    Apr 10, 2017 at 15:43
  • You also could use easy_install which allows to install the packages in your $HOME directory with easy_install --user <package-name>.
    – Thomas
    Apr 10, 2017 at 16:03

1 Answer 1

2

Like stated above sudo su elevates your privileges and you are basically running the command as root. Just using sudo without the su will do the same. You can also try running your command as such:

pip3 install --user numpy

This will install the package to your account and not into the system python environment. I would highly recommend that you read up on virtual environments for installing any additional packages/modules since installing them into your system python environment can muck things up.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .