ALINK(一):PYALINK安装(win10)

一 安装最新版本PyAlink

pip install -i http://pypi.douban.com/simple/ --trusted-host=pypi.douban.com/simple pyalink

报错的话,可能是网络问题。多试几次或者单独安装报错的包

二 验证示例(单机运行)

1.启动notebook

jupyter notebook

2.示例

import numpy as np
import pandas as pd
from pyalink.alink import *
def exampleData():
    return np.array([
        [1.0, "A", 0, 0, 0],
        [2.0, "B", 1, 1, 0],
        [3.0, "C", 2, 2, 1],
        [4.0, "D", 3, 3, 1]
    ])


def sourceFrame():
    data = exampleData()
    return pd.DataFrame({
        "f0": data[:, 0],
        "f1": data[:, 1],
        "f2": data[:, 2],
        "f3": data[:, 3],
        "label": data[:, 4]
    })


def batchSource():
    return dataframeToOperator(
        sourceFrame(),
        schemaStr='''
    f0 double, 
    f1 string, 
    f2 int, 
    f3 int, 
    label int
    ''',
        op_type='batch'
    )


(
    AppendIdBatchOp()
    .setIdCol("append_id")
    .linkFrom(batchSource())
    .print()
)

结果:

 

 

三 卸载旧版

在安装新版本PyAlink前,需要卸载旧的版本。一般来说直接用如下命令就可以

pip uninstall pyalink

但是这个命令针对使用pip install 安装的版本有效,PyAlink在1.1.0之前的版本是通过easy_install来安装的,所以使用easy_install -m pyalink进行卸载,下面是在Jupyter上使用该命令得到的结果:

在运行信息中显示了原egg安装文件的路径,可以再按此路径找到egg文件进行删除。至此就完全卸载了旧版本。

卸载完成后,运行pip search pyalink查看版本情况,运行结果如下图所示,只显示了最新版本信息,已经没有了本地安装版本。






原文地址:https://www.cnblogs.com/qiu-hua/p/14864862.html