如何在python中安装png模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31142919/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to install the png module in python
提问by Xmodder Xpos
I'm kind of new to installing modules in python. I looked at this, http://pythonhosted.org/pypng/png.html#png.Reader.asRGB8But there is no download link.
我对在 python 中安装模块有点陌生。我看了这个, http://pythonhosted.org/pypng/png.html#png.Reader.asRGB8但是没有下载链接。
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.
它说“安装是微不足道的”,但微不足道的手段没有什么价值或重要性。所以我在谷歌上搜索“python png 模块下载”,但所有链接都是针对“pypng”的,它说使用 import png 而不是 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.
然后我用谷歌搜索如何安装 python 模块,我遇到了简单的安装。但容易安装也有自己的安装。
Is my best bet to use c# or c++ instead where it's much easier to download libraries?
我最好的选择是使用 c# 或 c++ 来代替下载库容易得多的地方?
回答by Andersson
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
这些是相同的包,但应该安装并以不同的名称导入
回答by Melchia
I encountered several errors while trying to install pypng
.
I solved it with running it as ROOT:
我在尝试安装pypng
. 我以 ROOT 身份运行它解决了这个问题:
$ sudo pip install pypng
回答by Tactopoda
Here is another option, for conda users:
对于 conda 用户,这是另一种选择:
conda install -c eaton-lab pypng