Vladimir Vargas Vladimir Vargas - 1 year ago 127
Python Question

Installing python2 modules if default python is python3

I have installed Anaconda3 to get all the modules for python 3. However there are some codes which must be run in python 2. I don't have any installed python 2 module. I tried installing numpy via:

pip2.7 install numpy

But got an error:

OSError: [Errno 13] Permission denied:

Whenever I want to install a module I get the same error, for instance, with the NLTK module I get

OSError: [Errno 13] Permission denied:

How can I fix this?


Answer Source

If you don't have sudo or otherwise proper permissions, you might try installing in a user-writable directory via the "user" flag:

pip2 install --user numpy

The location is customizable with the PYTHONUSERBASE variable. Read all about it (and more) here: https://pip.pypa.io/en/stable/user_guide/#user-installs

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download