!pip install nltk -> permission denied

删除回忆录丶 提交于 2019-12-11 12:30:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!