Как установить Matplotlib в Ubuntu 14.04?

Мотивация в 14,04: 16.04 багги для производственного использования. 14.04 единственный стабильный. 15.10 также багги. Их upstart/systemd с runit ужасен.

Я работаю masi@masi:~/BitTorrentSync/IPython$ sudo -H pip install matplotlib

Collecting matplotlib
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading matplotlib-1.5.1.tar.gz (54.0MB)
    100% |████████████████████████████████| 54.0MB 26kB/s 
    Complete output from command python setup.py egg_info:
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [1.5.1]
                    python: yes [2.7.6 (default, Jun 22 2015, 17:58:13)  [GCC
                            4.8.2]]
                  platform: yes [linux2]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.11.0]
                  dateutil: yes [using dateutil version 2.5.3]
                      pytz: yes [using pytz version 2016.4]
                    cycler: yes [cycler was not found. pip will attempt to
                            install it after matplotlib.]
                   tornado: yes [using tornado version 4.3]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [The C/C++ header for freetype2 (ft2build.h)
                            could not be found.  You may need to install the
                            development package.]
                       png: no  [pkg-config information for 'libpng' could not
                            be found.]
                     qhull: yes [pkg-config information for 'qhull' could not be
                            found. Using local copy.]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite. Please install it with pip or
                            your preferred tool to run the test suite / mock is
                            required to run the matplotlib test suite. Please
                            install it with pip or your preferred tool to run
                            the test suite]
            toolkits_tests: yes [nose 0.11.1 or later is required to run the
                            matplotlib test suite. Please install it with pip or
                            your preferred tool to run the test suite / mock is
                            required to run the matplotlib test suite. Please
                            install it with pip or your preferred tool to run
                            the test suite]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt5agg: no  [PyQt5 not found]
                    qt4agg: yes [installing, Qt: 4.8.6, PyQt: 4.8.6; PySide not
                            found]
                   gtk3agg: yes [installing, version 3.8.10]
                 gtk3cairo: yes [installing, version 3.8.10]
                    gtkagg: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                            be found.  You may need to install the development
                            package.]
                     tkagg: no  [TKAgg requires Tkinter.]
                     wxagg: no  [requires wxPython]
                       gtk: no  [The C/C++ header for gtk (gtk/gtk.h) could not
                            be found.  You may need to install the development
                            package.]
                       agg: yes [installing]
                     cairo: yes [installing, pycairo version 1.8.8]
                 windowing: no  [Microsoft Windows only]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: yes [version 9.10]
                     latex: no
                   pdftops: yes [version 0.24.5]

    OPTIONAL PACKAGE DATA
                      dlls: no  [skipping due to configuration]

    ============================================================================
                            * The following required packages can not be built:
                            * freetype, png

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5VdgT2/matplotlib/

куда код ошибки 1 не возвратил соответствующих потоков. Я получил точно ту же ошибку при выполнении команды без sudo -H. Это - незавершенная установка, пытаясь использовать модуль, который Вы получаете

ImportError: No module named matplotlib.pyplot

Предложение в комментарии. Я работаю sudo apt-get install libfreetype6-dev libpng12-dev успешно. Я работаю успешно sudo -H pip install matplotlib. Однако я получаю предупреждение при выполнении matplotlib модуля теперь

/usr/local/lib/python2.7/dist-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')

Как можно установить matplotlib в Ubuntu 14.04?

1
задан 29 May 2016 в 13:22

1 ответ

Комментарий Edwinksl и поток . Последнее предупреждение является предупреждением кэша шрифта. Запустите ipython, чтобы узнать каталог

In [2]: import matplotlib
In [3]: matplotlib.get_cachedir()
Out[3]: u'/home/masi/.cache/matplotlib'

кэша Matplotlib В моем случае, удалить

rm /home/masi/.cache/matplotlib/fontList.cache 
rm -r /home/masi/.cache/matplotlib/tex.cache/

Теперь, выполнить Ваш matplotlib тестовый код снова. Я получил ту же ошибку снова с первым показом. Я работаю во второй раз тестового кода, и случай был разрешен. Предложение Edwinksl, почему это имеет поведение

, я предполагаю, что первое повторение действительно создает кэши, так как они не существуют. На втором повторении matplotlib знает, что кэши существуют, таким образом, это не потрудилось создавать их снова.

0
ответ дан 29 May 2016 в 23:22

Другие вопросы по тегам:

Похожие вопросы: