meta meta - 9 days ago 5
Python Question

Unable to install nltk in a virtual environment?

After activating the virtual environment, when I try:

$ sudo pip install -U nltk


it shows this message:


Requirement already up-to-date: nltk in /usr/local/lib/python2.7/dist-packages


Why isn't it downloading those packages?
Should I use --no-site-packages while activating?

Answer

Wait, if you are inside the virtual environment, you shouldn't use sudo.

In fact, using sudo will spawn a new shell that may have different variables, and thus this sudo-shell will be outside the virtual environment. (Note: this paragraph is speculation; I have not tested it.)

Try again without sudo.

Comments