数据处理单元(Data processing unit,DPU)是一种可编程电子电路,它具有数据处理以及硬件加速功能,数据处理单元主要用于数据中心内的数据计算处理。一个DPU通常含有一个中央处理器 、 网卡和可编程数据硬件加速引擎,因此DPU可以像中央处理器那样处理数据的同时还可以处理网络封包。
CPU v GPU v DPU: What Makes a DPU Different?
A DPU is a new class of programmable processor that combines three key elements. A DPU is a system on a chip, or SoC, that combines:
An industry-standard, high-performance, software-programmable, multi-core CPU, typically based on the widely used Arm architecture, tightly coupled to the other SoC components.
A high-performance network interface capable of parsing, processing and efficiently transferring data at line rate, or the speed of the rest of the network, to GPUs and CPUs.
A rich set of flexible and programmable acceleration engines that offload and improve applications performance for AI and machine learning, zero-trust security, telecommunications and storage, among others.
安装:
pip install pyinstaller
如果安装慢,可引用清华源:
# 清华源
pip install pyinstaller -i https://pypi.tuna.tsinghua.edu.cn/simple/
cmd 切换到 python 文件的目录,执行命令:
pyinstaller -F -w -i python.ico watermark.py
在dist 文件夹下,可以找到打包好的exe 文件
详细参数
在上面的打包命令中,用到了好几个参数:-F,-W,-i,这些参数的含义如下面的表格:
参数 用法
-F 生成结果是一个 exe 文件,所有的第三方依赖、资源和代码均被打包进该 exe 内
-D 生成结果是一个目录,各种第三方依赖、资源和 exe 同时存储在该目录(默认)
-a 不包含unicode支持
-d 执行生成的 exe 时,会输出一些log,有助于查错
-w 不显示命令行窗口
-c 显示命令行窗口(默认)
-p 指定额外的 import 路径,类似于使用 python path
-i 指定图标
-v 显示版本号
-n 生成的 .exe 的文件名
pyinstaller -F -w -i python.ico watermark.py 就表示 -F,打包只生成一个 exe 文件,-w,在运行程序的时候不打打开命令行的窗口,-i 就是打包带有自己设置的 ico 图标。
PyAutoGUI 通过Python scripts自动控制鼠标和键盘的一系列操作来控制其它程序,已达到自动化(测试)目的。
安装方式,
Windows上,可以使用py.exe 运行最新版本的Python:
py -m pip install pyautogui
如果安装了多个版本的Python,需要指明版本号,如Python 3.8:
py -3.8 -m pip install pyautogui
按键精灵实践,
import pyautogui,time
print(pyautogui.position())
while True:
pyautogui.moveTo(960, 600, duration=1) # 移动到 (960,600)
pyautogui.mouseUp() # 鼠标释放
pyautogui.click() # 鼠标当前位置点击一下
pyautogui.mouseUp() # 鼠标释放
time.sleep(238)
pyautogui.mouseUp() # 鼠标释放
常用功能
获取当前鼠标的位置
x,y=pyautogui.position()
print x,y # 输出的结果是:312,198 (结果是鼠标当前位置,可以想象成以屏幕左上角为原点的第一象限)
当前屏幕分辨率
pyautogui.size() # 输出的结果是:(1920,1080) (结果是当前屏幕分辨率)
x,y是否在屏幕上
pyautogui.onScreen(x,y) # 输出的结果是:True/False
鼠标函数
pyautogui.moveTo(x,y,s) #鼠标在s秒移动到(x,y),同理还有拖动方法dragTo(x,y,s)
pyautogui.click(x,y) #鼠标点击(x,y)
pyautogui.rightClick(x,y) #鼠标右击(x,y),同理还有middleClick(中击),doubleClick(双击),tripleClick(三击)
pyautogui.scroll(x,y) #鼠标在(x,y)滚动
pyautogui.mouseDown(x,y,button='left') #鼠标左边按下,同理mouseUp为鼠标松开
键盘函数
pyautogui.typewrite("hello") #输入"hello"
pyautogui.typewrite(['a','b','c']) #按键a,b,c,
pyautogui.hotkey('ctrl','c') #按键ctrl+c
pyautogui.keyUp(key_name) #松开键盘
pyautogui.keyDown(key_name) #按下键盘
信息弹窗函数
pyautogui.alert('stop') # 出现"stop"的警示框
截屏函数
image=pyautogui.screenshot(region(0,0,300,400)) # region是截图范围,可以返回截图
location= pyautogui.locateOnScreen('apple.png') #返回图片的位置
x,y =pyautogui.locateCenterOnScreen('apple.png') #返回图片中心的位置
伪静态,nginx里添加如下配置即可,可避免安装后/admin 出现404的状况
location / {
try_files $uri $uri/ /index.php?$args;
}
location ^~ /bl-content/tmp/ { deny all; }
location ^~ /bl-content/pages/ { deny all; }
location ^~ /bl-content/databases/ { deny all; }