简体   繁体   中英

Pip NLTK install issue on Ubuntu using Virtualenv

For reference here is the nltk installation documentation nltk here

Is there a way to install nltk using pip and virtualenv? I have installed the dependencies using pip into my virtualenv but when I attempt to install nltk it fails.

The error is that there is no setup script. There is source installation instructions for linux on the nltk site to do sudo python setup.py install. But how could I do this into a virtualenv?

Pip downloads and starts to install nltk so surely they plan for people to use pip if its in the package index.

It looks like pip is grabbing the first .tar.gz package from PyPI. For nltk, this is a macosx binary. You will have to explicitly point pip to the correct package.

The easiest way to do this is to just provide the full path to the package.

pip install http://pypi.python.org/packages/source/n/nltk/nltk-2.0.1rc1.tar.gz

The other solution is to download the package to a known directory and install it from there. For example, say you download the package to ~/Downloads . The command would be:

pip install ~/Downloads/nltk-2.0.1rc1.tar.gz

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