简体   繁体   中英

Can't install NLTK with setup.py

I have installed python 2.7 and am trying to set up nltk to do some data analysis (I'm fairly new to the whole programming game). However, I can't seem to install nltk. I downloaded setuptools but it keeps telling me that it can't be found. Do any of you python masters know how to fix this? :)

$ python ez_setup.py
ez_setup.py:129: Warning: 'as' will become a reserved keyword in Python 2.6
File "ez_setup.py", line 129
except pkg_resources.VersionConflict as VC_err:
                                      ^
SyntaxError: invalid syntax

$ sudo git clone     https://github.com/nltk/nltk.git
Password:
Cloning into 'nltk'...
remote: Reusing existing pack: 48415, done.
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 48422 (delta 0), reused 2 (delta 0)
Receiving objects: 100% (48422/48422), 65.84 MiB | 1.78 MiB/s, done.
Resolving deltas: 100% (32659/32659), done.
Checking connectivity... done

$ cd nltk

$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 33, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools

It seems you do not have python2.7-dev is not installed. Try installing python2.7-dev as below and try running setup again.

$ sudo apt-get install python2.7-dev
$ sudo python setup.py install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM