博文

目前显示的是 五月, 2025的博文

MySQL中更改root的密码

1、先登录mysql命令行: sudo  mysql 2、执行命令: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ' 你的新密码 '; FLUSH PRIVILEGES; 3、退出mysql命令行: exit; 4、重新登陆: mysql -u root -p (输入上面设置好的密码即可!)

Ubuntu下安装Mysql

1、更新包索引 sudo apt update sudo apt upgrade -y 2、安装MySql服务器 sudo apt install mysql-server -y --------------- sudo systemctl start mysql sudo systemctl enable mysql      # 开机自启 sudo systemctl status mysql     --------------- 3、运行安全配置脚本 sudo mysql_secure_installation 4、登陆MySql: sudo mysql 5、设置root登陆密码: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY ' yourpassword '; FLUSH PRIVILEGES; exit; 退出mysql并使用命令重新登陆: sudo mysql -u root -p ------------------------------- ************************************* 数据库管理命令 说明 SHOW DATABASES; | 查看所有数据库 | CREATE DATABASE mydb; | 创建数据库 | DROP DATABASE mydb; | 删除数据库 | USE mydb; | 切换数据库 | SELECT DATABASE(); | 显示当前使用的数据库 | -------------------------- 用户与权限管理命令 说明 CREATE USER 'user'@'localhost' IDENTIFIED BY 'password'; | 创建用户 | GRANT ALL PRIVILEGES ON db.* TO 'user'@'localhost'; | 授予权限 | REVOKE ALL PRIVILEGES ON db.* FROM 'user'@'localhost'; | 撤销权限 | DROP USE...

Mamba-Conda的极速替代者

在数据科学和机器学习领域,Conda是一个广受欢迎的包管理器和环境管理器。然而,随着项目规模的增长,Conda在处理大量依赖时可能会显得缓慢。Mamba,一个由Conda-Forge社区开发的Conda替代品,以其更快的包安装速度而受到关注。 Mamba:Conda的加速器 Mamba旨在作为Conda的替代品,它使用Conda的相同环境和依赖模型赖 , 但提供了更快的包安装速度。Mamba通过并行下载和更高效的解决依赖算法来实现这一目标。 安装Mamba: conda update -n base -c defaults conda -y conda install mamba -c conda-forge -y ------------------------------------- 最初安装MiniConda: 1)、下载 $ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh 或者 $ wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-latest-Linux-x86_64.sh 2)、安装 $ bash Miniconda3-latest-Linux-x86_64.sh 3)、验证安装 conda --version 出现版本号,则表示安装成功! 4)、配置 安装过程中提示: conda config --set auto_activate_base false You can undo this by running 'conda init --reverse $SHELL' [yes|no] ************ 如果,想让 Conda 命令在每次打开终端时都能用(推荐),打开命令终端自动激活base虚拟环境,则输入 yes 反正,则输入 no 5)、更新镜像源 「添加清华源」: conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main conda config --add channels https://mirrors.tuna...

配置FileSystem文件操作的MCP

类型: stdio 命令: npx 参数: -y @modelcontextprotocol/server-filesystem /Users/zhangfan/Downloads/excel (当前路径必须存在且 正确 ,是允许MCP访问的文件夹) ----------------------------------------   如果是MAC系统,还要为cherryStudio开启整个磁盘的访问权限!

配置Excel的MCP服务

类型:stdio 命令:npx 参数: --yes @zhiweixu/excel-mcp-server 环境变量: LOG_PATH=/Users/zhangfan/Downloads/logs (路径必须存在且正确)

Mac中安装和卸载UV

A、安装: brew install uv 安装完毕后,执行命令: uv --version 展示版本信息,则表明安装成功! B、卸载: which uv 查看uv文件安装的路径 例如: /opt/anaconda3/bin/uv 执行删除命令: rm -f /opt/anaconda3/bin/uv 删除执行完毕即可! --------------------------- Ubuntu中如何安装UV: curl -LsSf https://astral.sh/uv/install.sh | sh

Ubuntu中部署谷歌的Medgemma X光影像识别模型

1、创建虚拟环境: conda create -n medgemma python=3.10 -y && conda activate medgemma 2、克隆项目 git clone https://githubfast.com/Google-Health/medgemma.git cd medgemma 3、安装项目相关依赖: pip install --upgrade transformers[torch] accelerate bitsandbytes torch pillow gradio requests pillow timm -i https://pypi.tuna.tsinghua.edu.cn/simple 4、配置模型下载的相关库: pip install -U huggingface_hub -i https://pypi.tuna.tsinghua.edu.cn/simple export HF_ENDPOINT=https://hf-mirror.com (模型下载前需要先去huggingface上找到谷歌的这个项目获取授权) https://huggingface.co/google/medgemma-4b-it 5、编写测试代码app.py: #!/usr/bin/env python # -*- coding: utf-8 -*- from transformers import AutoProcessor, AutoModelForImageTextToText from PIL import Image import torch # ———— (可选)显式开启 TorchDynamo ———— # torch._dynamo.enable() # 模型标识 model_id = "google/medgemma-4b-it" # 加载模型(不禁用 Dynamo) model = AutoModelForImageTextToText.from_pretrained(     model_id,     torch_dtype=torch.bfloat16,     device_map="auto", ) # 加载预处理器 processor = Aut...

Ubuntu中部署Qwen 2.5 Omni多模态模型(支持视频分析)

准备工作: a、更新Nvidia最新的驱动程序,并安装好Cuda b、下载模型文件 (本例中通过modelscope下载: pip install modelscope -i https://pypi.tuna.tsinghua.edu.cn/simple export MODELSCOPE_CACHE= /home/zhangfanxp/aiproject/MyCode/ modelscope download --model Qwen/Qwen2.5-Omni-3B ) ---------------------------------------------------------------------------------------------------------- 1、创建虚拟环境 conda create -n Omni3B python=3.10 -y && conda activate Omni3B 2、安装Pytorch及相关库 pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu126 3、安装cuda-toolkit conda install -c nvidia cuda-toolkit -y 4、安装Transformers框架 pip install git+https://github.com/huggingface/transformers@3a1ead0aabed473eafe527915eea8c197d424356 ( 执行 git+https这行命令 必须可以科学上网,可以把主机接入软路由试试看,多试几次! ) pip install accelerate sentencepiece soundfile -i https://pypi.tuna.tsinghua.edu.cn/simple 5、安装qwen omni utils pip install "qwen-omni-utils[decord]" -i https://pypi.tuna.tsinghua.edu.cn/simple 6、安装flash att...

表情迁移项目LivePortrait本地部署中的坑

前提准备: 从Nvidia官网下载最新版的驱动程序: https://www.nvidia.com/en-us/drivers/ 授权.run文件的运行权限: sudo chmod +x  filename.run --------------------------------------------------------------------------------- 1、克隆项目至本地: git clone https://github.com/KwaiVGI/LivePortrait 2、创建虚拟环境: conda create -n LivePortrait python= 3.11 && conda activate LivePortrait 官方文档让创建3.10的python,我改为了3.11 3、安装最新版scipy pip install scipy -i https://pypi.tuna.tsinghua.edu.cn/simple 4、修改 requirements_base.txt文件 去掉其中的 scipy==1.13.1一行 把gradio的版本号去掉(无版本号则安装最新版本) 5、在pytorch官网( https://pytorch.org/get-started/previous-versions/ )找到对应(或相近的)cuda版本安装命令,并安装: 我RTX 3060安装后的CUDA是 12.8, 因此,找到12.6的安装命令: pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu126 6、安装项目依赖库: pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple 7、下载模型: pip install -U huggingface_hub -i https://pypi.tuna.tsinghua.edu.cn/simple export HF_ENDPOINT=https://hf-mirror.com huggingface-c...

MAC中配置Docker镜像源

进入设置(setting)中的Docker Engine 编辑: {   "builder": {     "gc": {       "defaultKeepStorage": "20GB",       "enabled": true     }   },   "experimental": false ,   "registry-mirrors": [     " https://hub.dk18.xyz "   ] } 应用并重启(Apple & Restart) 退出Docker, 从新启动MAC电脑 ,使用docker pull命令下载镜像即可,速度很快! 命令行中运行命令,查看当前镜像源: docker info | grep "Registry Mirrors" -A 5 --------------------------------------------------------------------- false后面要加 英文逗号 ,其实是在原有配置文件中增加三行代码:   "registry-mirrors": [     " https://hub.dk18.xyz "   ] ======================================= Docker中搭建apache服务: docker pull httpd docker run -d --name my-apache -p 8080:80 httpd 浏览器中访问: http://127.0.0.1:8080/ 可查看到「 It works! 」则表示docker中的apache容器已成功创建! ======================================= 《本地搭建IPTV镜像源》 IPTV本地Docker镜像拉取命令: docker镜像拉取: docker pull doubebly/doube-itv:latest 启动docker中的相关镜像后,浏览器访问: http://localhost:5088/help 查看...

Mac下安装Brew

1、确保网络环境可以翻墙 2、安装xcode: xcode-select -- install 3、安装brew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 不翻墙的情况下运行(使用国内的镜像安装): /bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)" 4、配置环境变量: echo >> /Users/ frank /.zprofile echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/ frank /.zprofile eval "$(/opt/homebrew/bin/brew shellenv)" 5、测试: brew --version ------------------------------------------ 更换brew镜像源: git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zprofile source ~/.zprofile brew update

MAC下如何翻墙

1、DragonVPN,可以从官网直接下载MAC版 www.dragonvpn.cc 2、V2box和Hiffdy可以使用美版Apple账号直接从apple store中安装 (zhangfanxp@gmail.com)

Ubuntu 24中安装Docker Desktop版本

图片
1、从Docker官网下载Desktop版本的deb安装包: https://docs.docker.com/desktop/setup/install/linux/ubuntu/ 2、依次执行下面的命令: sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc echo \   "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \   $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \   sudo tee /etc/apt/sources.list.d/docker.list > /dev/null (参看网址:https://docs.docker.com/engine/install/ubuntu/#install-using-the-repository) 然后,再执行命令: sudo apt-get update 3、进入deb安装包所在的文件夹,执行安装命令: sudo dpkg -i ./docker-desktop-amd64.deb ---------------------------------------------------------------------------------- 在Ubuntu中执行 sudo apt-get install ./docker-desktop-amd64.deb 安装命令,提示错误: 正在读取软件包列表... 完成 正在...

Time MCP配置

图片
mcp-server-time --local-timezone Etc/GMT-8

node项目环境隔离

1、创建一个文件夹 2、通过cd命令进入文件夹 3、执行初始化命令: npm init -y Node.js: Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行时,用来在服务器端或命令行里运行 JavaScript npm(Node Package Manager): 是 Node.js 官方自带的包管理工具(用于安装、管理和发布 JavaScript 依赖包),既是命令行工具,也是一个线上包管理/托管平台(registry)。 npx: npx是npm 5.2.0版本引入的一个工具,旨在{简化执行}Node.js包的过程。使用npx,你可以直接运行一个可能没有全局安装的命令行工具,而无需先将其安装到你的项目中。 pnpm: 是一个替代npm和yarn的新的包管理器。它的目标是更高效地管理和安装包。高效的第三方包管理器,通过内容可寻址存储和硬链接实现更快安装和更少磁盘占用

Mac下两种部署playwright MCP Server的方式

 方法一、Docker部署: 项目地址: https://github.com/torohash/playwright-sse-mcp-server 1、克隆项目到本地: git clone https://github.com/torohash/playwright-sse-mcp-server.git cd playwright-sse-mcp-server 2、创建docker网络 docker network create mcp-network 3、根据项目文件构建镜像 docker compose up --build 构建成功后,会展示:   ✔ playwright-sse-mcp-server             Built                                                                                                                           0.0s     ✔ Container playwright-sse-mcp-server   Created                                    ...