pip工具使用总结以及常用库PIL、freetype的安装
pip工具安装使用
pip为python库软件管理工具pip docs
安装
wget https://bootstrap.pypa.io/ez_setup.py -O - | python
安装setuptools
https://pypi.python.org/pypi/setuptoolswget https://bootstrap.pypa.io/get-pip.py -O - | python
安装pip工具
ttps://pypi.python.org/pypi/pip
get-pip.py会安装依赖的包setuptools和wheel如果没安装的话。
使用
列出已安装的包:
pip freeze
或pip list
导出requirements.txt:
pip freeze > <dir>/requirements.txt
在线安装:
pip install <packagename>
或pip install -r requirements.txt
####### example-requirements.txt ####### # ###### Requirements without Version Specifiers ###### nose nose-cov beautifulsoup4 # ###### Requirements with Version Specifiers ###### # See https://www.python.org/dev/peps/pep-0440/#version-specifiers docopt == 0.6.1 # Version Matching. Must be version 0.6.1 keyring >= 4.1.1 # Minimum version 4.1.1 coverage != 3.5 # Version Exclusion. Anything except version 3.5 Mopidy-Dirble ~= 1.1 # Compatible release. Same as >= 1.1, == 1.* # ###### Refer to other requirements files ###### -r other-requirements.txt # # ###### A particular file ###### ./downloads/numpy-1.9.2-cp34-none-win32.whl http://wxpython.org/Phoenix/snapshot-builds/wxPython_Phoenix-3.0.3.dev1820+49a8884-cp34-none-win_amd64.whl # ###### Additional Requirements without Version Specifiers ###### # Same as 1st section, just here to show that you can put things in any order. rejected green # ###### Other arguments ###### --no-index --index-url https://pypi.python.org/simple/ --find-links /my/local/archives --find-links http://some.archives.com/archives
离线安装:
pip install <目录>/<文件名>
pip install --use-wheel --no-index --find-links=wheelhouse/ <包名>
pip install --no-index --find-links=[file://]<DIR> -r requirements.txt
pip install --no-index -f=<目录>/ <包名>
卸载包:
pip uninstall <包名>
或pip uninstall -r requirements.txt
升级包:
pip install -U <包名>
显示包文件:
pip show -f <包名>
搜索包:
pip search <搜索关键字>
查询可升级的包:
pip list -o
下载离线包:
pip install <包名> -d <目录>
或pip install -d <目录> -r requirements.txt
下载离线包:
pip wheel -w <目录> <包名>
或pip wheel -w <目录> -r requirements.txt
下载包以及其依赖包的whl文件到指定目录下打包:
pip wheel <包名>
pip install -e . # 安装当前目录已打包好的项目 pip install -e path/to/project # 安装指定目录已打包好的项目pip install -e git+https://git.repo/some_pkg.git#egg=SomePackage # from git pip install -e hg+https://hg.repo/some_pkg.git#egg=SomePackage # from mercurial pip install -e svn+svn://svn.repo/some_pkg/trunk/#egg=SomePackage # from svn pip install -e git+https://git.repo/some_pkg.git@feature#egg=SomePackage # from ‘feature’ branch pip install -e “git+https://git.repo/some_repo.git#egg=subdir&subdirectory=subdir_path” # install a python package from a repo subdirectorypip install –pre SomePackage # 安装预发行和安装的版本,默认安装的是稳定版本
更换源
国内pypi源:
- 豆瓣:http://pypi.doubanio.com/simple
- 淘宝:http://mirrors.aliyun.com/pypi/simple/
临时更改:pip install <包名> -i http://pypi.doubanio.com/simple
通过配置文件指定全局安装源
在unix和macos,配置文件为:$HOME/.pip/pip.conf
在windows上,配置文件为:%HOME%\pip\pip.ini
[global]
timeout = 6000
index-url = http://pypi.doubanio.com/simple
使用技巧
安装编译过的库
1、 检查支持的tagsimport pip; print(pip.pep425tags.get_supported())
2、下载对应版本的windows下编译好的二进制库 http://www.lfd.uci.edu/~gohlke/pythonlibs/安装含有扩展模块的库
pip install --global-option=build_ext --global-option="-I/usr/local/unixODBC2_3_0/include" --global-option="-L/usr/local/unixODBC2_3_0/lib" pyodbc
常用第三方库的安装
总结一些常用库的安装方法,用作备忘录
PIL安装
图像处理是一门应用非常广的技术,而拥有非常丰富第三方扩展库的 Python 当然不会错过这一门盛宴。PIL (Python Imaging Library)是 Python 中最常用的图像处理库,目前版本为 1.1.7,参考官方资料http://effbot.org/imagingbook/
Image 类是 PIL 库中一个非常重要的类,通过这个类来创建实例可以有直接载入图像文件,读取处理过的图像和通过抓取的方法得到的图像这三种方法。
注意PIL与pillow不兼容。
window7与CenOS7下安装PIL的方法不同,以下方法仅作参考
CentOS7
- 依赖库安装:
yum install -y python-devel libjpeg libjpeg-devel zlib zlib-devel freetype freetype-devel lcms lcms-devel
- 下载最新的PIL包:
wget http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz
- 手动安装:
tar zxvf Imaging-1.1.17.tar.gz cd Imaging-1.1.7/ python python setup.py install
- 依赖库安装:
window7 64bit
pillow有32bit与64bit之分,具体安装请参考官方资料https://pillow.readthedocs.org/en/latest/installation.html,或者手动下载https://pypi.python.org/pypi/Pillow,Pillow-3.1.1-cp27-none-win_amd64.whl,然后手动安装pip install Pillow-3.1.1-cp27-none-win_amd64.whl
或者从第三方网站下载对应的安装包:http://www.lfd.uci.edu/~gohlke/pythonlibs/
freetype安装
FreeType库是一个完全免费(开源)的、高质量的且可移植的字体引擎,它提供统一的接口来访问多种字体格式文件。在字体图片生成中常常会用到。
win10 64bit 安装
https://pypi.org/project/freetype-py/
There are no official Freetype binary releases available, but they offer some
links to precompiled Windows DLLs. Please see theFreeType Downloads <https://www.freetype.org/download.html>
_ page for links.
- 通过pip工具进行安装
pip install freetype-py
, 提示安装成功 - 下载安装依赖动态库,否则在使用时报错
RuntimeError: Freetype library not found
从https://github.com/ubawurinna/freetype-windows-binaries下载对应的动态库放在PATH路径下
anaconda
- 下载安装https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
- 配置国内的安装库
- conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- conda config --set show_channel_urls yes
- 升级匹配:
conda update pip
- 创建tensorflow的依赖环境
- conda create -n tensorflow python=3.5
- pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ https://mirrors.tuna.tsinghua.edu.cn/tensorflow/windows/cpu/tensorflow-1.1.0-cp35-cp35m-win_amd64.whl
参考:
- Python 之 使用 PIL 库做图像处理
- 廖雪峰的官方网站-PIL
pip工具使用总结以及常用库PIL、freetype的安装相关推荐
- python语言中、用来安装第三方库的命令_python安装第三方库的方法
python安装第三方库的方法 发布时间:2020-09-03 11:22:15 来源:亿速云 阅读:76 作者:小新 小编给大家分享一下python安装第三方库的方法,相信大部分人都还不怎么了解,因 ...
- python3.6安装库_python3.6怎么安装库
Python3.6安装第三方库有两种方式: 1. 使用 pip 命令行工具在线下载你需要的第三方库 2. 手动下载第三方库,再使用 pip 命令安装 1. 使用 pip 命令行工具在线下载你需要的第三 ...
- Python库:Pyinstaller库、pip工具、pip指定安装源和版本
一.需求: 需要将我们编写的扩展名为.py的源代码,转换成无需源代码的可执行文件.希望用可执行文件的方式执行一个程序,而不是源代码. 因为在有的Windows平台.Linux平台,Mac平台操作系统上 ...
- 抖之恒科技python常用库之工具库schema
在Python编程语言中,有众多的开源库可以帮助程序员更加高效地完成各种任务.其中,Schema就是一款非常实用的工具库之一.本文将为您介绍Schema库的基本概念.使用方法以及它在Python编程中 ...
- 安装python扩展库时只能使用pip_安装 Python 扩展库时只能使用 pip 工具在线安装,如果安装不成功就没有别的办法了。_学小易找答案...
[单选题]关于Python中的复数,下列说法错误的是_________________. [填空题]在Python程序中,导入sys模块后,可以通过列表________________访问命令行参数. ...
- 艺赛旗RPA 第三方库系列(二):提升 pip 工具的下载速度
目前艺赛旗RPA已经更新到8.0版本,可以让所有用户免费下载试用http://www.i-search.com.cn/index.html?from=line1 (复制链接下载) pip 工具默认从国 ...
- [转载] python常用库
参考链接: Python–新一代语言 转载至:https://www.cnblogs.com/jiangchunsheng/p/9275881.html 今天我将介绍20个属于我常用工具的Python ...
- python 常用库收集
读者您好.今天我将介绍20个属于我常用工具的Python库,我相信你看完之后也会觉得离不开它们.他们是: Requests.Kenneth Reitz写的最富盛名的http库.每个Python程序员都 ...
- Python常用库 - 【持续整理归档】
Python常用库 - [持续整理归档],比较多,会逐步慢慢细化分类和扩从python常用库.(最后更新:2020-4-8) 为方便Python开发人员进行敏捷开发,高效的完成工作需求,耗时很久整理的 ...
最新文章
- Linux(11)-Linux系统下用户权限管理
- docker配置国内镜像源
- iis7 上传限制问题
- 使用ANTLR和Java创建外部DSL
- sparkSession常见参数设置
- java 读取 xmltype_java操作XMLType的几种方法
- 敏捷开发生态系统系列之四:计划跟踪II(自组织团队-开发团队自己估算-PO挑战估算-同行压力)...
- 实践:不同编程语言, 函数检测多属性的全部合理的具体实现。
- bzoj千题计划176:bzoj1199: [HNOI2005]汤姆的游戏
- 天网防火墙引起的蓝屏
- 微型计算机系统评课,微机课评课稿.pdf
- java 排序sort_Java排序方法sort的使用详解(转)
- python日历教程_基于python实现简单日历
- HDFS Rack Awareness详解
- 【车间调度】基于matlab帝国企鹅算法求解柔性车间调度问题【含Matlab源码 1991期】
- PyTorch搭建LSTM实现时间序列预测(负荷预测)
- 电脑更换硬盘应该注意什么?
- C++ 类(静态成员和静态函数)
- 小学计算机教学打字,怎么快速学拼音打字-小学生如何更快的学习拼音
- KeyboardHolder: macOS系统的输入法切换辅助工具
热门文章
- OpenJTAG调试S3C2440裸板程序
- 小程序和vue语法对比_React语法开发微信小程序 Demo
- java 线程数_在虚拟机中是什么限制java线程数量?这方面涉及哪些调优?
- 获取显示器的唯一编号_宝马奔驰才配拥有的HUD抬头显示器,买菜车也能无损安装!...
- 解决:VMware DHCP Service 服务无法启动
- axure web组件下载_Element - 饿了么团队出品的神级桌面 UI 组件库
- 仙逆网页服务器失败,全民仙逆闪退进不去了怎么办 闪退解决办法汇总
- java signed_如何从java中的字节读取signed int?
- linux相关英文书记,Linux常用软件(英文介绍)
- redis setnx原子性_不支持原子性的 Redis 事务也叫事务吗?