我正在嘗試爲Django項目安裝ntlk。我也跟着上NTLK網站上的intstructions,和我他們的工作,因爲當我嘗試使用PIP重新安裝,我得到:在Mac OSX上安裝ntlk的問題
➜ Word_Maker git:(master) sudo pip install -U numpy
Requirement already up-to-date: numpy in /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages
Cleaning up...
➜ Word_Maker git:(master) sudo pip install -U pyyaml nltk
Requirement already up-to-date: pyyaml in /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages
Requirement already up-to-date: nltk in /Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages
Cleaning up...
然而,當我從python3做進口ntlk,我得到:
Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 16 2013, 23:39:35)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/nltk/__init__.py", line 37
except IOError, ex:
^
SyntaxError: invalid syntax
^
語法錯誤:無效語法
但是,導入numpy作品。任何幫助,將不勝感激!
要求已更新:'nltk' in ... 而您正在嘗試「import ntlk'。嘗試使用'import nltk'。即檢查拼寫 – EWit
哇,真是愚蠢的錯誤。現在,我收到了這個錯誤:Python 3.3.3(v3.3.3:c3896275c0f6,2013年11月16日,23:39:35) [GCC 4.2.1(Apple Inc. build 5666)(dot 3)] darwin 輸入「幫助」,「版權」,「信用」或「許可證」以獲取更多信息。 >>>進口NLTK 回溯(最近通話最後一個): 文件 「」,1號線,在 文件「/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-包/ NLTK/__ init__。py「,第37行 除了IOError,例如: ^ SyntaxError:無效的語法 –
goodcow