我正在尝试建立一个可以访问png模块的Python 3环境。当我列出已安装的软件包时,得到以下信息:
(Python3_Env) me@gimli:~$ conda list
# packages in environment at /home/me/anaconda2/envs/Python3_Env:
#
# Name Version Build Channel
ca-certificates 2018.03.07 0
certifi 2018.4.16 py37_0 anaconda
click 6.7 py37_0
flask 1.0.2 py37_1
itsdangerous 0.24 py37_1
jinja2 2.10 py37_0
libedit 3.1.20170329 h6b74fdf_2
libffi 3.2.1 hd88cf55_4
libgcc-ng 7.2.0 hdf63c60_3
libpng 1.6.34 hb9fc6fc_0 anaconda
libstdcxx-ng 7.2.0 hdf63c60_3
markupsafe 1.0 py37h14c3975_1
ncurses 6.1 hf484d3e_0
openssl 1.0.2o h20670df_0 anaconda
pip 10.0.1 py37_0
png 1.2.39 0 sssdgc
pypng 0.0.18 0 eaton-lab
python 3.7.0 hc3d631a_0
readline 7.0 ha6073c6_4
setuptools 39.2.0 py37_0
sqlite 3.24.0 h84994c4_0
tk 8.6.7 hc745277_3
werkzeug 0.14.1 py37_0
wheel 0.31.1 py37_0
xz 5.2.4 h14c3975_4
zlib 1.2.11 ha838bed_2
因为我有png,pypng和libpng,所以我真的希望能够导入png,但是当我尝试时,我得到了:
(Python3_Env) me@gimli:~$ python
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import png
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'png'
>>>
关于安装到conda环境中是否还需要安装其他东西?
答案 0 :(得分:0)
conda软件包sssdgc::png
似乎是libpng12:
$ conda create -yp ./p sssdgc::png
$ find p
p
p/conda-meta
p/conda-meta/png-1.2.39-0.json
p/conda-meta/history
p/bin
p/bin/libpng-config
p/bin/libpng12-config
p/include
p/include/libpng12
p/include/libpng12/png.h
p/include/libpng12/pngconf.h
p/include/png.h
p/include/pngconf.h
p/lib
p/lib/pkgconfig
p/lib/pkgconfig/libpng.pc
p/lib/pkgconfig/libpng12.pc
p/lib/libpng.a
p/lib/libpng.la
p/lib/libpng.so
p/lib/libpng.so.3
p/lib/libpng.so.3.39.0
p/lib/libpng12.a
p/lib/libpng12.la
p/lib/libpng12.so
p/lib/libpng12.so.0
p/lib/libpng12.so.0.39.0
p/share
p/share/man
p/share/man/man3
p/share/man/man3/libpng.3
p/share/man/man3/libpngpf.3
p/share/man/man5
p/share/man/man5/png.5
$ rm -fr p
conda软件包eaton-lab::pypng
似乎是pypng的错误包装版本:
$ conda create -yp ./p eaton-lab::pypng
$ find p
p
p/conda-meta
p/conda-meta/pypng-0.0.18-0.json
p/conda-meta/history
$ rm -fr p
您可以通过pip安装它:
$ conda install pip
$ pip install pypng
$ python -c 'import png; print(png.__version__)'
0.0.18
或者,从自动蟒蛇通道获取它(仅适用于python 2):
$ conda install auto::pypng
$ python -c 'import png; print(png.__version__)'
0.0.16