zoukankan      html  css  js  c++  java
  • python中安装第三方模块

    Python有两个封装了setuptools的包管理工具:easy_installpip。目前官方推荐使用pip

    现在,让我们来安装一个第三方库——Python Imaging Library,这是Python下非常强大的处理图像的工具库。一般来说,第三方库都会在Python官方的pypi.python.org网站注册,要安装一个第三方库,必须先知道该库的名称,可以在官网或者pypi上搜索,比如Python Imaging Library的名称叫PIL,因此,安装Python Imaging Library的命令就是:

    pip install PIL

    出现如下问题:

    Traceback (most recent call last): 
    File “/usr/bin/pip-python”, line 5, in <module> 
    from pkg_resources import load_entry_point 
    File “build/bdist.linux-x86_64/egg/pkg_resources.py”, line 2749, in <module> 
    File “build/bdist.linux-x86_64/egg/pkg_resources.py”, line 444, in _build_master 
    File “build/bdist.linux-x86_64/egg/pkg_resources.py”, line 725, in require 
    File “build/bdist.linux-x86_64/egg/pkg_resources.py”, line 628, in resolve 
    pkg_resources.DistributionNotFound: pip==0.8

    出现上述错误主要是由于python的版本太过老了,需要下载最新版本的setuptools

     无奈之下,只好去安装easy_install并安装。

    easy_install PIL
    --------------------------------------------------------------------
    PIL 1.1.7 SETUP SUMMARY
    --------------------------------------------------------------------
    version       1.1.7
    platform      linux2 2.7.3 (default, Jul  2 2014, 09:15:41)
                  [GCC 4.8.1]
    --------------------------------------------------------------------
    *** TKINTER support not available
    --- JPEG support available
    --- ZLIB (PNG/ZIP) support available
    --- FREETYPE2 support available
    *** LITTLECMS support not available
    --------------------------------------------------------------------
    To add a missing option, make sure you have the required
    library, and set the corresponding ROOT variable in the
    setup.py script.
    
    To check the build, run the selftest.py script.
    zip_safe flag not set; analyzing archive contents...
    Image: module references __file__
    Adding PIL 1.1.7 to easy-install.pth file
    Installing pilprint.py script to /usr/local/bin
    Installing pilfile.py script to /usr/local/bin
    Installing pilconvert.py script to /usr/local/bin
    Installing pildriver.py script to /usr/local/bin
    Installing pilfont.py script to /usr/local/bin
    
    Installed /usr/local/lib/python2.7/site-packages/PIL-1.1.7-py2.7-linux-i686.egg
    Processing dependencies for PIL
    Finished processing dependencies for PIL
  • 相关阅读:
    attr 修改IMG src
    64转2
    :eq
    DOM0和D0M2级事件
    c's's透明度
    span标签 宽度无效解决方案
    CSS 点击事件
    input点击后的 默认边框去除
    js
    CSS 的 ID 和 Class 有什么区别,如何正确使用它们。
  • 原文地址:https://www.cnblogs.com/wuchanming/p/4521401.html
Copyright © 2011-2022 走看看