Mac configuration Python Natural language processing environment

Source: Internet
Author: User
Tags install matplotlib nltk

Ⅰ, tool installation steps

1. Download the corresponding version of Setuptools from Https://pypi.python.org/pypi/setuptools according to the Python version. Then, run under the terminal,sudo sh downloads/setuptools-0.6c11-py2.7.egg

2. Install PIP under Terminal to run sudo easy_install pip

3, install NumPy and matplotlib. Run sudo pip install- u numpy matplotlib

4. Install Pyyaml and NLTK run sudo pip install- u pyyaml nltk

Ⅱ, Problems encountered 1, install PIP FAQ
" Pip " Homebrew provides pip via: ' Brew install Python '. However you'll thenhave-pythons installed on your Mac, so alternatively can installpip via the instructions at:< C13/>https://pip.readthedocs.org/en/stable/installing/#install-pip

Using:

sudo easy_install pip

Remember to add sudo

2. Installation Pyyaml FAQ:

sudo pip install-u pyyaml nltk

You encounter the following problem:

1.4. 1   in are due to the fact that uninstalling a distutils project would only partially uninstall th E project. Uninstalling six-1.4. 1 :...

Install with the following command:

sudo pip install libname--upgrade--ignore-installed Six

3. Then install the NLTK in the same manner as described above

4. Update Nmpy:
Pip Install--upgrade NumPy
Import Sklearn.datasetstraceback (most recent call last): File"<stdin>", line1,inch<module>File"/library/python/2.7/site-packages/sklearn/__init__.py", line $,inch<module> from.BaseImport Clone File"/library/python/2.7/site-packages/sklearn/base.py", line One,inch<module> from. Utils.fixes Import Signature File"/library/python/2.7/site-packages/sklearn/utils/__init__.py", lineTen,inch<module> from. MurmurHash Import murmurhash3_32 File"numpy.pxd", line155,inchInit Sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029) ValueError:numpy.dtype has the wrong size,Tryrecompiling

Reference Document: Https://blog.wizchen.com/2016/06/17/Mac%E4%B8%8B%E6%9B%B4%E6%96%B0python%E7%A7%91%E5%AD%A6%E8%AE%A1%E7%AE %97%e5%ba%93numpy/

The workaround is to close the SIP:

Restart the computer, press and hold the COMMAND+R when the computer starts, and so on the picture appears the Apple icon, will see opens a utility window, opens the terminal, enters:

Csrutil Disable

After the reboot is complete, enter the terminal again:sudo pip install-u numpy

Can be successful, remember to add sudo.

5, similarly, if you want to install Matplotlib:sudo pip installs matplotlib

And be sure to add sudo.

Second, NLTK use 1, enter into Python

>>>import NLTK

>>>nltk.download ()

will bring up a dialog box: can download the package

However, the download is generally unsuccessful. Need to download the packet manually

(You can contact the author of this article to the data package, you can also Baidu a bit, there will be resources), then you can carry out a variety of text experiments.

2. Self-Python experiment

Mac configuration Python Natural language processing environment

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.