如何在我的网络服务器上安装 NLTK
好的,我编辑了我的问题,因为我现在有一个支持 ssh 的主机。
如何使用 ssh 安装适用于 python 的 nltk 模块?
我尝试联系支持人员,但他们似乎无法帮助我。你们有什么想法吗?我如何在我的网络服务器上安装一般模块?主机相当于 sudo python setup.py install 的东西是什么?
Ok I edited my question since I now have a host that does support ssh.
How can i install the nltk module for python using ssh?
I tried contacting support but they can't seem to help me. You guys any ideas? How can I install modules in general on my webserver? what's the hosting's equivalent of sudo python setup.py install?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将需要 shell 访问权限(尽管不一定是
root
访问权限)才能正确安装 Python 模块。但是,由于您能够在远程执行 Python 代码,因此您也许能够设置一个可以通过运行
python setup.py install --home=DIR
用于远程 NLTK,其中 < code>DIR 是PYTHONPATH
您有写入权限的地方。 (不过,这个解决方案应该被认为是一个粗略的黑客攻击。)编辑:忘记上面的内容,很好,你有 shell 访问权限。创建一个目录
~/apps
(或类似目录),将其放入用于运行 Python Web 服务代码的帐户的PYTHONPATH
中(不一定是您自己的,请先检查)并使用 home 方案。You will need shell access (though not necessarily
root
access) to properly install a Python module.However, since you're able to execute Python code on the remote, you might be able to set up a script that you can run through a web browser that runs
python setup.py install --home=DIR
for NLTK on the remote, whereDIR
is a directory on yourPYTHONPATH
where you have write access. (This solution should be considered a crude hack, though.)EDIT: forget the above, good that you have shell access. Make a dir
~/apps
(or similar), put that in thePYTHONPATH
of the account used to run your Python web serving code (not necessarily your own, please check first) and install it in that dir using the home scheme.除了 @larsmans 的说明之外,您可能还需要下载 NLTK 安装的相关数据。为此,请在成功安装模块后运行以下命令:
然后,此功能将指导您完成下载语料库的过程。
In addition to @larsmans' instructions, you probably will also need to download relevant data for your NLTK installation. To do that, run the following after you successfully install the module:
This function will then guide you through the process of downloading the corpora.