Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install the png module in python

Tags:

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?

like image 594
Xmodder Xpos Avatar asked Jun 30 '15 15:06

Xmodder Xpos


People also ask

Can you use PNG in Python?

PyPNG is pure Python and has no dependencies. It requires Python 3.5 or any compatible higher version. to access the png module in your Python program. You can also install from source using setuptools .

How do I install an external package in Python?

The command to install any external Python package is pip install. The pip version can be checked using pip --version or pip -V. If the path shows Python 2.7, then make sure you have Python version 3 installed and then run pip as pip3.


2 Answers

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

like image 111
Andersson Avatar answered Sep 19 '22 11:09

Andersson


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

$ sudo pip install pypng 
like image 36
Melchia Avatar answered Sep 18 '22 11:09

Melchia