简体   繁体   中英

How to install the png module in python

I'm kind of new to installing modules in python. I looked at this, http://pythonhosted.org/pypng/png.html#png.Reader.asRGB8 But there is no download link.

It says "installation is trivial" but trivial means of little value or importance. So I google "python png module download" but all the links are for 'pypng' It says to use import png not import pypng.

So then I google how to install python modules, And I came across easy install. But easy install has its own installation also.

Is my best bet to use c# or c++ instead where it's much easier to download libraries?

Try to print in command line/Terminal:

pip install pypng

and then import in your code as

import png

These are the same packages but it should be installed and be imported under different names

I encountered several errors while trying to install pypng . I solved it with running it as ROOT:

$ sudo pip install pypng

On Ubuntu 20.04 this works:

  1. install pip

    sudo apt install python3-pip

  2. install png

    sudo pip3 install pypng

  3. import library in code

    import png

对于 conda 用户,这是另一种选择:

conda install -c eaton-lab pypng

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