Mac安装Python的biplist库
2017-09-15 本文已影响641人
Ampaw
当在终端执行Python脚本时,出现以下报错,说明你的Python缺少biplist库!
AmpawdeiMac:~ Ampaw$ /Users/Ampaw/Desktop/test.py
Traceback (most recent call last):
File "/Users/Ampaw/Desktop/test.py", line 3, in <module>
from biplist import *
ImportError: No module named biplist
AmpawdeiMac:~ Ampaw$
注意:Mac自带的Python是没有biplist库的,如果你的Python脚本需要添加biplist库才可以运行,应先安装biplist库。
安装方式
1. 使用setuptools工具安装,下载地址:http://pypi.python.org/pypi/setuptools 可以找到正确的版本进行下载
2. 直接安装biplist库,下载地址:https://pypi.python.org/pypi/biplist
具体操作
第一种方式,可以自行 百度 来安装工具,这里主要介绍第二种方式直接下载安装biplist库。
- 下载biplist库压缩文件,并解压缩
- 终端执行命令,切换到biplist库文件目录
cd ~/biplist库文件
- 终端执行命令,安装biplist库
sudo python setup.py install
- 执行命令后,显示以下信息时,表示biplist库,安装成功!
AmpawdeiMac:biplist-1.0.2 Ampaw$ sudo python setup.py install
Password:
running install
Checking .pth file support in /Library/Python/2.7/site-packages/
/usr/bin/python -E -c pass
TEST PASSED: /Library/Python/2.7/site-packages/ appears to support .pth files
running bdist_egg
running egg_info
writing biplist.egg-info/PKG-INFO
writing top-level names to biplist.egg-info/top_level.txt
writing dependency_links to biplist.egg-info/dependency_links.txt
reading manifest file 'biplist.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'biplist.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.12-intel/egg
running install_lib
running build_py
creating build/bdist.macosx-10.12-intel
creating build/bdist.macosx-10.12-intel/egg
creating build/bdist.macosx-10.12-intel/egg/biplist
copying build/lib/biplist/__init__.py -> build/bdist.macosx-10.12-intel/egg/biplist
byte-compiling build/bdist.macosx-10.12-intel/egg/biplist/__init__.py to __init__.pyc
creating build/bdist.macosx-10.12-intel/egg/EGG-INFO
copying biplist.egg-info/PKG-INFO -> build/bdist.macosx-10.12-intel/egg/EGG-INFO
copying biplist.egg-info/SOURCES.txt -> build/bdist.macosx-10.12-intel/egg/EGG-INFO
copying biplist.egg-info/dependency_links.txt -> build/bdist.macosx-10.12-intel/egg/EGG-INFO
copying biplist.egg-info/not-zip-safe -> build/bdist.macosx-10.12-intel/egg/EGG-INFO
copying biplist.egg-info/top_level.txt -> build/bdist.macosx-10.12-intel/egg/EGG-INFO
creating dist
creating 'dist/biplist-1.0.2-py2.7.egg' and adding 'build/bdist.macosx-10.12-intel/egg' to it
removing 'build/bdist.macosx-10.12-intel/egg' (and everything under it)
Processing biplist-1.0.2-py2.7.egg
creating /Library/Python/2.7/site-packages/biplist-1.0.2-py2.7.egg
Extracting biplist-1.0.2-py2.7.egg to /Library/Python/2.7/site-packages
Adding biplist 1.0.2 to easy-install.pth file
Installed /Library/Python/2.7/site-packages/biplist-1.0.2-py2.7.egg
Processing dependencies for biplist==1.0.2
Finished processing dependencies for biplist==1.0.2
AmpawdeiMac:biplist-1.0.2 Ampaw$