Python (Win 10): Installing matplotlib requires packages “freetype” and “png”?

后端 未结 2 950
-上瘾入骨i
-上瘾入骨i 2020-12-21 09:54

I\'ve been trying to install Python\'s matplotlib library for use with PyPlot, for use with Julia. I managed to get everything in place except for this one final library, an

相关标签:
2条回答
  • 2020-12-21 10:37

    Use a more powerful installer

    I would recommend to use Anaconda or Miniconda. In my experience with many Windows users, this is the simplest way to install packages such as matplotlib.

    Anaconda

    Anaconda comes with many packages for scientists. Matplotlib works out of the box. Just install as user not root.

    Minoconda

    If you don't want all packages of Ananconda use Miniconda

    Conda

    Both ways of installation (Anaconda or Miniconda) provide conda. It is an improved pip/virtualenv.

    You can install matplotilb with this command:

    conda install matplotlib
    

    Enviroments:

    You can create a new environment and install the packages you like:

    conda create -n my_project35 python=3.5
    activate my_project35
    conda install matplotlib
    

    or

    conda create -n my_project27 python=2.7
    activate my_project27
    conda install matplotlib
    

    Combine with pip

    You can still use pip. conda "understands" what it is doing.

    0 讨论(0)
  • 2020-12-21 10:39

    One snake is enough!

    [This is for folks using the Linux Bash Shell on Windows 10.]

    If you don't want to go the Anaconda route, you can install freetype (and png) by executing the following in the Windows 10 Bash shell:

    sudo apt-get install freetype6-dev
    

    The above command will also automatically install libpng. However, due to an error, the system will not 'realize' it has installed freetype, so you'll need to manually install pkg-config:

    sudo apt-get install pkg-config
    

    Thereafter you should be able to install matplotlib via pip without further incident.

    sudo pip install matplotlib
    
    0 讨论(0)
提交回复
热议问题