常用python组件包

基于python3.6安装的组件包列表

$ pip list
Package                Version
---------------------- -------------
aniso8601              2.0.0
asn1crypto             0.23.0
astroid                1.6.2
attrs                  17.2.0
Automat                0.6.0
awscli                 1.14.14
bcrypt                 3.1.4
beautifulsoup4         4.6.0
bleach                 1.5.0
boto                   2.48.0
boto3                  1.5.8
botocore               1.8.22
bs4                    0.0.1
bz2file                0.98
certifi                2017.7.27.1
cffi                   1.11.0
chardet                3.0.4
click                  6.7
colorama               0.3.9
constantly             15.1.0
coreapi                2.3.3
coreschema             0.0.4
cryptography           2.0.3
cssselect              1.0.1
cycler                 0.10.0
cymem                  1.31.2
cypari                 2.2.0
Cython                 0.28.2
cytoolz                0.8.2
de-core-news-sm        2.0.0
decorator              4.1.2
dill                   0.2.7.1
Django                 1.11.5
django-redis           4.8.0
django-rest-swagger    2.1.2
djangorestframework    3.7.3
docutils               0.14
dpath                  1.4.2
en-blade-model-sm      2.0.0
en-core-web-lg         2.0.0
en-core-web-md         2.0.0
en-core-web-sm         2.0.0
entrypoints            0.2.3
es-core-news-sm        2.0.0
fabric                 2.0.1
Fabric3                1.14.post1
fasttext               0.8.3
flasgger               0.8.3
Flask                  1.0.2
Flask-RESTful          0.3.6
flask-swagger          0.2.13
fr-core-news-md        2.0.0
fr-core-news-sm        2.0.0
ftfy                   4.4.3
future                 0.16.0
FXrays                 1.3.3
gensim                 3.0.0
h5py                   2.7.1
html5lib               0.9999999
hyperlink              17.3.1
idna                   2.6
incremental            17.5.0
invoke                 1.0.0
ipykernel              4.6.1
ipython                6.2.0
ipython-genutils       0.2.0
ipywidgets             7.0.1
isort                  4.3.4
it-core-news-sm        2.0.0
itsdangerous           0.24
itypes                 1.1.0
jedi                   0.11.0
jieba                  0.39
Jinja2                 2.10
jmespath               0.9.3
joblib                 0.11
jsonpath               0.75
jsonschema             2.6.0
jupyter                1.0.0
jupyter-client         5.1.0
jupyter-console        5.2.0
jupyter-core           4.3.0
Keras                  2.0.8
keyring                12.2.1
lazy-object-proxy      1.3.1
lxml                   4.0.0
Markdown               2.6.9
MarkupSafe             1.0
matplotlib             2.0.2
mccabe                 0.6.1
mistune                0.8.3
msgpack-numpy          0.4.1
msgpack-python         0.5.2
murmurhash             0.28.0
nbconvert              5.3.1
nbformat               4.4.0
ner                    0.1
networkx               2.1
nltk                   3.2.5
notebook               5.1.0
numpy                  1.14.0rc1+mkl
olefile                0.44
openapi-codec          1.3.2
pandas                 0.23.0
pandocfilters          1.4.2
paramiko               2.4.1
parsel                 1.2.0
parso                  0.1.0
pathlib                1.0.1
pickleshare            0.7.4
Pillow                 4.2.1
pip                    10.0.1
plac                   0.9.6
plink                  2.2
preshed                1.0.0
prompt-toolkit         1.0.15
protobuf               3.4.0
psutil                 5.4.3
py4j                   0.10.6
pyasn1                 0.3.6
pyasn1-modules         0.1.4
pycparser              2.18
PyDispatcher           2.0.5
Pygments               2.2.0
pylint                 1.8.3
pymssql                2.1.3
PyMySQL                0.7.11
PyNaCl                 1.2.1
pyOpenSSL              17.3.0
pyparsing              2.2.0
pypng                  0.0.18
pyreadline             2.1
pyspark                2.3.0
python-dateutil        2.6.1
python-snappy          0.5.2
pytz                   2017.2
pywin32-ctypes         0.1.2
PyYAML                 3.12
pyzmq                  16.0.2
qtconsole              4.3.1
queuelib               1.4.2
redis                  2.10.6
regex                  2017.4.5
requests               2.18.4
rsa                    3.4.2
s3transfer             0.1.12
scikit-learn           0.19.1
scikit-surprise        1.0.6
scipy                  1.0.0
Scrapy                 1.4.0
seaborn                0.8.1
service-identity       17.0.0
setuptools             28.8.0
sh                     1.12.14
simplegeneric          0.8.1
simplejson             3.13.2
six                    1.11.0
smart-open             1.5.3
snappy                 2.6
snappy-manifolds       1.0
spacy                  2.0.7
spherogram             1.8
stanfordcorenlp        3.8.0.1
swagger-py-codegen     0.2.9
tensorflow             1.3.0
tensorflow-tensorboard 0.1.8
termcolor              1.1.0
testpath               0.3.1
Theano                 0.9.0
thinc                  6.10.2
toolz                  0.9.0
tornado                4.5.2
tqdm                   4.19.5
traitlets              4.3.2
tushare                1.1.6
Twisted                17.9.0
ujson                  1.35
uritemplate            3.0.0
urllib3                1.22
virtualenv             15.1.0
w3lib                  1.18.0
wcwidth                0.1.7
webencodings           0.5.1
Werkzeug               0.14.1
wheel                  0.30.0
widgetsnbextension     3.0.3
wordcloud              1.4.1
wrapt                  1.10.11
xgboost                0.71
zope.interface         4.4.3

Python Windows Binaries 库下载地址

Unofficial Windows Binaries for Python Extension Packages
如果在Windows, pip install python库失败,或许是依赖的某个python包安装失败。
可以尝试从这个网站,将安装失败的组件包下载到本地,进行直接文件安装之后,再尝试重新安装主组件包

常用python组件包_第1张图片
2018-05-24 10_34_59-Python Extension Packages for Windows - Christoph Gohlke.png

Python代码Sample网址

Python Code Examples

常用python组件包_第2张图片
2018-05-24 10_35_12-Python Example.png

常用组件包

1. 数据科学领域

Numpy

Numpy提供了两种基本的对象:ndarray和ufunc。ndarray是存储单一数据类型的多维数组,而ufunc是能够对数组进行处理的函数。Numpy的功能:

  • N维数组,一种快速、高效使用内存的多维数组,他提供矢量化数学运算。
  • 可以不需要使用循环,就能对整个数组内的数据进行标准数学运算。
  • 非常便于传送数据到用低级语言编写(C\C++)的外部库,也便于外部库以Numpy数组形式返回数据。

Numpy不提供高级数据分析功能,但可以更加深刻的理解Numpy数组和面向数组的计算。

Pandas

Pandas是Python的一个数据分析包,Pandas最初被用作金融数据分析工具而开发出来,因此Pandas为时间序列分析提供了很好的支持。
Pandas是为了解决数据分析任务而创建的,Pandas纳入了大量的库和一些标准的数据模型,提供了高效的操作大型数据集所需要的工具。Pandas提供了大量是我们快速便捷的处理数据的函数和方法。Pandas包含了高级数据结构,以及让数据分析变得快速、简单的工具。它建立在Numpy之上,使得Numpy应用变得简单。

  • 带有坐标轴的数据结构,支持自动或明确的数据对齐。这能防止由于数据结构没有对齐,以及处理不同来源、采用不同索引的数据而产生的常见错误。
  • 使用Pandas更容易处理丢失数据。
  • 合并流行数据库(如:基于SQL的数据库)
    Pandas是进行数据清晰/整理的最好工具。
    Pandas是机器学习组件应用的数据处理基石

Matplotlib

Matplotlib是Python的一个可视化模块,他能方便的只做线条图、饼图、柱状图以及其他专业图形。
使用Matplotlib,可以定制所做图表的任一方面。他支持所有操作系统下不同的GUI后端,并且可以将图形输出为常见的矢量图和图形测试,如PDF SVG JPG PNG BMP GIF.通过数据绘图,我们可以将枯燥的数字转化成人们容易接收的图表。
Matplotlib是基于Numpy的一套Python包,这个包提供了吩咐的数据绘图工具,主要用于绘制一些统计图形。
Matplotlib有一套允许定制各种属性的默认设置,可以控制Matplotlib中的每一个默认属性:图像大小、每英寸点数、线宽、色彩和样式、子图、坐标轴、网个属性、文字和文字属性。

2. 机器学习领域

Scikit-Learn

Scikit-Learn是基于Python机器学习的模块,基于BSD开源许可证。
Scikit-Learn的安装需要Numpy Scopy Matplotlib等模块,Scikit-Learn的主要功能分为六个部分,分类、回归、聚类、数据降维、模型选择、数据预处理。
Scikit-Learn自带一些经典的数据集,比如用于分类的iris和digits数据集,还有用于回归分析的boston house prices数据集。该数据集是一种字典结构,数据存储在.data成员中,输出标签存储在.target成员中。Scikit-Learn建立在Scipy之上,提供了一套常用的机器学习算法,通过一个统一的接口来使用,Scikit-Learn有助于在数据集上实现流行的算法。
Scikit-Learn还有一些库,比如:用于自然语言处理的Nltk、用于网站数据抓取的Scrappy、用于网络挖掘的Pattern、用于深度学习的Theano等。

Xgboost

Xgboost,顾名思义是极度梯度提升算法,用于监督学习。
可以这样理解,一般遇到分类问题,可以用随机森林或者Xgboost先试一下结果。

Introduction to Boosted Trees

XGBoost is short for “Extreme Gradient Boosting”, where the term “Gradient Boosting” is proposed in the paper Greedy Function Approximation: A Gradient Boosting Machine, by Friedman. XGBoost is based on this original model. This is a tutorial on gradient boosted trees, and most of the content is based on these slides by the author of xgboost.

The GBM (boosted trees) has been around for really a while, and there are a lot of materials on the topic. This tutorial tries to explain boosted trees in a self-contained and principled way using the elements of supervised learning. We think this explanation is cleaner, more formal, and motivates the variant used in xgboost.

Elements of Supervised Learning

XGBoost is used for supervised learning problems, where we use the training data (with multiple features) xi to predict a target variable yi. Before we dive into trees, let us start by reviewing the basic elements in supervised learning

TensorFlow

TensorFlow是谷歌基于DistBelief进行研发的第二代人工智能学习系统,其命名来源于本身的运行原理。Tensor(张量)意味着N维数组,Flow(流)意味着基于数据流图的计算,TensorFlow为张量从流图的一端流动到另一端计算过程。TensorFlow是将复杂的数据结构传输至人工智能神经网中进行分析和处理过程的系统。

TensorFlow可被用于语音识别或图像识别等多项机器学习和深度学习领域,对2011年开发的深度学习基础架构DistBelief进行了各方面的改进,它可在小到一部智能手机、大到数千台数据中心服务器的各种设备上运行。TensorFlow将完全开源,任何人都可以用。

Spacy

Spacy
Spacy是隶属于NLP(自然语言处理)的python组件。
官方介绍:spaCy excels at large-scale information extraction tasks. It's written from the ground up in carefully memory-managed Cython. Independent research has confirmed that spaCy is the fastest in the world. If your application needs to process entire web dumps, spaCy is the library you want to be using.
实际应用中:Spacy支持多语言,提供相对完善的已有模型,做分词,实体识别非常好用,而且效率很高
与主流NLP组件的对比:

常用python组件包_第3张图片
2018-05-24 10_37_39-Facts & Figures · spaCy Usage Documentation.png

Gensim

我写的一篇用Gensim做相似度应用的帖子
Gensim is a free Python library designed to automatically extract semantic topics from documents, as efficiently (computer-wise) and painlessly (human-wise) as possible.

Gensim is designed to process raw, unstructured digital texts (“plain text”). The algorithms in gensim, such as Latent Semantic Analysis, Latent Dirichlet Allocation and Random Projections discover semantic structure of documents by examining statistical co-occurrence patterns of the words within a corpus of training documents. These algorithms are unsupervised, which means no human input is necessary – you only need a corpus of plain text documents.

Once these statistical patterns are found, any plain text documents can be succinctly expressed in the new, semantic representation and queried for topical similarity against other documents.

3. 演示或练习领域

Jupyter + IPython

IPython provides a rich architecture for interactive computing with:

  • A powerful interactive shell.
  • A kernel for Jupyter.
  • Support for interactive data visualization and use of GUI toolkits.
  • Flexible, embeddable interpreters to load into your own projects.
  • Easy to use, high performance tools for parallel computing.

IPython is a growing project, with increasingly language-agnostic components. IPython 3.x was the last monolithic release of IPython, containing the notebook server, qtconsole, etc. As of IPython 4.0, the language-agnostic parts of the project: the notebook format, message protocol, qtconsole, notebook web application, etc. have moved to new projects under the name Jupyter. IPython itself is focused on interactive Python, part of which is providing a Python kernel for Jupyter.

The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

4. Web开发领域

Django

在 Python 社区,Django 是目前最有影响力的 Web 开发框架。该框架很重型,内置了 Web 服务端开发常用的组件。

Django 应用范围很广,比如 Google 的 Web 开发平台 GAE 就支持它。

Django 完全支持 Jython 运行环境,可以运行在任何 J2EE 服务器上。

Flask

Flask是一个Python编写的Web 微框架,让我们可以使用Python语言快速实现一个网站或Web服务。
使用Flask可以非常快捷的开发与部署Restful API,而且可以结合flask-swagger组件,非常方便发布Swagger API演示Website

5. 运维工具

Fabric

Fabric是一个Python的库,它提供了丰富的同SSH交互的接口,可以用来在本地或远程机器上自动化、流水化地执行Shell命令。因此它非常适合用来做应用的远程部署及系统维护。其上手也极其简单,你需要的只是懂得基本的Shell命令。
需要注意的是:

  • 安装版本
    -- 对于2.x版本,安装通过pip install fabric
    -- 对于3.x版本,安装通过pip install fabric3
    示例:
from fabric.api import *
env.hosts = ["10.86.17.84"]
env.user = "hduser"
env.key_filename="./conf/id_rsa.pem"

def testls():
    run("ls -l /usr/local")

def starthadoop():
    run("/usr/local/hadoop/sbin/start-all.sh")
    run("screen -d -m /usr/local/hive/bin/hive --service metastore -p 9083", pty=False)
    run("/usr/local/spark/sbin/start-all.sh")

def stophadoop():
    run("/usr/local/spark/sbin/stop-all.sh")
    run("/usr/local/hadoop/sbin/stop-all.sh")
    pids = run("ps -ef | grep hive | grep -v 'grep' | awk '{print $2'}")
    pid_list = pids.split('\r\n')
    if len(pid_list) >=1 and len(pid_list[0]) != 0:
        for i in pid_list:
            run('kill -9 %s' % i)

6. AWS专用组件

BOTO3

Boto 是AWS的基于python的SDK(当然还支持其他语言的SDK,例如Ruby, Java等),Boto允许开发人员编写软件时使用亚马逊等服务像S3和EC2等,Boto提供了简单,面向对象的API,也提供了低等级的服务接入。这里大家要区分,Boto有两个版本,其中旧的版本boto2已经不推荐使用了,在一些亚马逊新建的region已经不支持旧的Boto2了(貌似中国就是这样的),所以如果开发Python代码的话建议大家使用Boto3,为什么不推荐Boto2呢?应为Boto2大概是2006年开发的,现在的好多的服务当时都没有开发出来,所以Boto2点设计没有考虑后续的这么多新增多服务,所以重新开发了Boto3.
目前通过boto3控制AWS resource非常简单,只要~/.aws/credentials 配置OK,通过如下语句,就能连上S3:

import boto3
s3 = boto3.resource("s3")
for bucket in s3.buckets.all():
    print(bucket.name)

#boto3上传object to s3:
#多个tagging通过Tagging="key1=value1&key2=value2" 这种方式生成
s3.Bucket(s3conf["bucket"]). \
    put_object(
    Key=gzipfile.replace(".\output\\", "").replace("\\", "/")
    , Body=data
    , Tagging="companyid=0C0000183U")

你可能感兴趣的:(常用python组件包)