Mac installation Numpy,scipy,matplotlib

Source: Internet
Author: User

saintkings-mac-mini:~saintking$ Pythonpython2.7.Ten(default, Jul -  ., -: to: the) [GCC4.2.1Compatible Apple LLVM8.0.0(clang-800.0. the)] on Darwintype" Help","Copyright","credits"Or"License"  forMore information.>>>Help () Welcome to Python2.7! This isThe online Help utility. If This  isYour first timeusingPython, you should definitely check outThe tutorial on the Internet at http://docs.python.org/2.7/tutorial/.Enter the name of any module, keyword, or topic toGetHelp on Writingpython programs andusingPython modules. To quit ThisHelp utility andreturnTo the interpreter, just type"quit". toGetA list of available modules, keywords, or topics, type"Modules","keywords", or"Topics". Each module also comes with a one-Line summaryof What it does, to list the modules whose summaries contain a given Wordsuch as "spam", type"modules spam". Help> NumPy
View Code

>>> Import NumPy as NP

>>> np.multiply (1,3)

3

>>>

The NumPy installation is complete.

1. Install numpy2. Install SCIPY3. Installation Matplotlib

Help> scipy

Help> matplotlib

The inspection has been successfully installed.

Test it:

>>> Import Matplotlib.pyplot asPlttraceback (most recent): File"<stdin>", line1,inch<module>File"/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/matplotlib/pyplot.py", line in,inch<module> frommatplotlib.figure Import figure, Figaspect File"/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/matplotlib/figure.py", line $,inch<module> frommatplotlib.axes Import axes, subplotbase, subplot_class_factory File"/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/matplotlib/axes.py", line -,inch<module>Import Matplotlib.dates as_ # <-Registers a date unit converter File"/system/library/frameworks/python.framework/versions/2.7/extras/lib/python/matplotlib/dates.py", line119,inch<module> fromdateutil.rrule Import (Rrule, MO, TU, WE, TH, FR, SA, SU, yearly, File"/users/saintking/library/python/2.7/lib/python/site-packages/dateutil/rrule.py", line +,inch<module> fromsix.moves Import _thread, rangeimporterror:cannot import name _thread
View Code

Solve the problem.

Because Python's version is too low. Now with 3.6

saintkings-mac-mini:~ saintking$ which Python

/usr/bin/python

Mv/usr/bin/python/usr/bin/python_backup

mv /usr/local/bin/python /usr/local/bin/python_backup

>>> Import Matplotlib.pyplot as Plt

In many cases we want to ignore the past download of the installation package, the direct download installation can use –ignore-installed This parameter, such as I found the matplotlib Mplot3d part of a bit of a problem, I would like to re-download the installation again, can do so

This will download the relevant packages (NumPy, Pytz, six, Python-dateutil, Cycler, pyparsing, matplotlib) and install them all over again.

saintkings-mac-mini:~ saintking$ sudo pip install--upgrade--ignore-installed matplotlib

Password:

The directory '/users/saintking/library/caches/pip/http ' or its parent directory isn't owned by the current user and the The cache has been disabled. Please check the permissions and owner for that directory. If executing pip with sudo, your may want sudo ' s-h flag.

The directory '/users/saintking/library/caches/pip ' or its parent directory isn't owned by the current user and caching W Heels has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, your may want sudo ' s-h flag.

Collecting Matplotlib

Downloading matplotlib-2.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_ INTEL.MACOSX_10_10_X86_64.WHL (13.2MB)

100% |████████████████████████████████| 13.2MB 77kb/s

Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from Matplotlib)

Downloading PYPARSING-2.2.0-PY2.PY3-NONE-ANY.WHL (56kB)

100% |████████████████████████████████| 61kB 901kb/s

Collecting numpy>=1.7.1 (from Matplotlib)

Downloading numpy-1.13.3-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_ INTEL.MACOSX_10_10_X86_64.WHL (4.6MB)

100% |████████████████████████████████| 4.6MB 164kb/s

Collecting Pytz (from Matplotlib)

Downloading PYTZ-2017.2-PY2.PY3-NONE-ANY.WHL (484kB)

100% |████████████████████████████████| 491kB 442kb/s

Collecting Backports.functools-lru-cache (from Matplotlib)

Downloading BACKPORTS.FUNCTOOLS_LRU_CACHE-1.4-PY2.PY3-NONE-ANY.WHL

Collecting six>=1.10 (from Matplotlib)

Downloading SIX-1.11.0-PY2.PY3-NONE-ANY.WHL

Collecting cycler>=0.10 (from Matplotlib)

Downloading CYCLER-0.10.0-PY2.PY3-NONE-ANY.WHL

Collecting Subprocess32 (from Matplotlib)

Downloading subprocess32-3.2.7.tar.gz (54kB)

100% |████████████████████████████████| 61kB 599kb/s

Collecting python-dateutil>=2.0 (from Matplotlib)

Downloading PYTHON_DATEUTIL-2.6.1-PY2.PY3-NONE-ANY.WHL (194kB)

100% |████████████████████████████████| 194kB 522kb/s

Installing collected Packages:pyparsing, NumPy, Pytz, Backports.functools-lru-cache, six, Cycler, SUBPROCESS32, Python-dateutil, Matplotlib

Running setup.py Install for subprocess32 ... done

Successfully installed backports.functools-lru-cache-1.4 cycler-0.10.0 matplotlib-2.1.0 numpy-1.13.3 pyparsing-2.2.0 python-dateutil-2.6.1 pytz-2017.2 six-1.11.0 subprocess32-3.2.7

saintkings-mac-mini:~ saintking$ python

Python 2.7.10 (default, Jul, 18:31:42)

[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on Darwin

Type "Help", "copyright", "credits" or "license" for more information.

>>> Import Matplotlib.pyplot as Plt

>>> Plt.bar (left= (0,1), height= (1,0.5))

/library/python/2.7/site-packages/matplotlib/__init__.py:1710:matplotlibdeprecationwarning:the *left* Kwarg to ' Bar ' is deprecated use *x* instead. Support for *left* 'll be removed in Matplotlib 3.0

return func (Ax, *args, **kwargs)

<container object of 2 artists>

>>> Plt.show ()

>>>

Display:

 

Mac installation Numpy,scipy,matplotlib

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.