python中安装第三方模块

简介: Python有两个封装了setuptools的包管理工具:easy_install和pip。目前官方推荐使用pip。 现在,让我们来安装一个第三方库——Python Imaging Library,这是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

 

相关文章
|
5天前
|
Ubuntu Python
Ubuntu 安装Python3.8
Ubuntu 安装Python3.8
25 0
|
1天前
|
Python
【Python进阶(五)】——模块搜索及工作目录
【Python进阶(五)】——模块搜索及工作目录
|
2天前
|
关系型数据库 MySQL 数据库
Python Stock安装与使用
Python Stock安装与使用
|
2天前
|
Shell 数据安全/隐私保护 Docker
docker安装anaconda3 python环境
docker安装anaconda3 python环境
10 0
|
2天前
|
Python Windows
python中的异常与模块
python中的异常与模块
9 1
|
3天前
|
数据采集 iOS开发 MacOS
Python及Pycharm安装教程
Python及Pycharm安装教程
15 0
|
12天前
|
JSON 数据格式 Python
Python标准库中包含了json模块,可以帮助你轻松处理JSON数据
【4月更文挑战第30天】Python的json模块简化了JSON数据与Python对象之间的转换。使用`json.dumps()`可将字典转为JSON字符串,如`{&quot;name&quot;: &quot;John&quot;, &quot;age&quot;: 30, &quot;city&quot;: &quot;New York&quot;}`,而`json.loads()`则能将JSON字符串转回字典。通过`json.load()`从文件读取JSON数据,`json.dump()`则用于将数据写入文件。
17 1
|
13天前
|
Python
Python实现压缩解压---tarfile模块详解
Python实现压缩解压---tarfile模块详解
|
13天前
|
Linux Python Windows
Python虚拟环境virtualenv安装保姆级教程(Windows和linux)
Python虚拟环境virtualenv安装保姆级教程(Windows和linux)
|
13天前
|
机器学习/深度学习 数据可视化 数据挖掘
Python绘图工具Matplotlib安装与使用,快速上手
Python绘图工具Matplotlib安装与使用,快速上手