Xmodder Xpos
Xmodder Xpos

Reputation: 391

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?

Upvotes: 39

Views: 88798

Answers (4)

Niels Tolstrup
Niels Tolstrup

Reputation: 467

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

Upvotes: 4

user2821
user2821

Reputation: 1604

Here is another option, for conda users:

conda install -c eaton-lab pypng

Upvotes: 1

Melchia
Melchia

Reputation: 24334

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

$ sudo pip install pypng

Upvotes: 6

Andersson
Andersson

Reputation: 52695

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

Upvotes: 63

Related Questions