I have just installed pypng
library with sudo -E pip install pypng
. I see this library in the list when I execute pip list
(the version that I see there is 0.0.18
).
When I start python (or ipython) session and execute
import pypng
I get
ImportError: No module named pypng
According to docs on github you need to import png.
import png
png.from_array([[255, 0, 0, 255],
[0, 255, 255, 0]], 'L').save("small_smiley.png")
I think the module name is just png. Try the following:
import png
Library name is not always the name of installed package. For the pypng
it is just png
, as noted in the documentation .
In case, if the documentation does not provide enough info, you could use pip show
in order to list all installed files for specified package:
$ python -m pip show -f pypng
Metadata-Version: 2.0
Name: pypng
Version: 0.0.18
Summary: Pure Python PNG image encoder/decoder
Home-page: https://github.com/drj11/pypng
Author: David Jones
Author-email: drj@pobox.com
License: UNKNOWN
Location: /usr/lib/python3.5/site-packages
Requires:
Files:
__pycache__/png.cpython-35.pyc
png.py
pypng-0.0.18.dist-info/DESCRIPTION.rst
pypng-0.0.18.dist-info/INSTALLER
pypng-0.0.18.dist-info/METADATA
pypng-0.0.18.dist-info/RECORD
pypng-0.0.18.dist-info/WHEEL
pypng-0.0.18.dist-info/metadata.json
pypng-0.0.18.dist-info/top_level.txt
As you can see, there is png.py
file, which is being imported with import png
.
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.