问题
I'm trying to install nltk with the following notebook command:
!pip install nltk
However, that throws the following error:
error: could not create '/usr/local/src/bluemix_ipythonspark_141/notebook/lib/python2.7/site-packages/nltk':
Permission denied
How can I install nltk from the Jupyter notebook? Note that the spark environments on bluemix can only be accessed via the notebook. There isn't she'll access to the environment.
回答1:
As the question is about IPython notebooks on Bluemix, the following suffices:
!pip install --user nltk
There is no need for manipulating sys.path
.
回答2:
The solution was to install from the notebook as follows:
!pip install --user nltk
Then in the next cell enter:
import os
says.path.append(os.getenv('HOME')+'/.local/lib/python2.7/site-packages')
import nltk
Update: you shouldn't have to manipulate the sys.path as stated in the accepted answer.
回答3:
I am not sure if the actual issue is a permission issue or something else. If you have sudo access, you can try running the above command with a sudo prefix to it and see if it fixes it.
回答4:
Try this command
sudo pip install -U nltk
来源:https://stackoverflow.com/questions/34031360/pip-install-nltk-permission-denied