![](/img/trans.png)
[英]How to install cx_oracle python module for Google Colaboratory
[英]No module named 'nltk.lm' in Google colaboratory
我正在嘗試在 Google 協作筆記本中導入 NLTK 語言建模模塊 ( nltk.lm ),但沒有成功。 我已經嘗試從 nltk 安裝所有東西,但仍然沒有成功。
我會犯什么錯誤或遺漏?
提前致謝。
Google Colab 已安裝nltk v3.2.5
,但在v3.4
中添加了nltk.lm
(語言建模包)。
在您的 Google Colab 運行中:
!pip install -U nltk
在 output 中,您會看到它下載了新版本,並卸載了舊版本:
...
Downloading nltk-3.6.5-py3-none-any.whl (1.5 MB)
...
Successfully uninstalled nltk-3.2.5
...
You must restart the runtime in order to use newly installed versions.
單擊 output 末尾所示的Restart runtime
按鈕。
現在它應該工作了!
您可以使用以下代碼仔細檢查nltk
版本:
import nltk
print('The nltk version is {}.'.format(nltk.__version__))
您需要v3.4
或更高版本才能使用nltk.lm
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.