Centos离线安装ansible

Centos离线安装ansible

1、首先是互联网环境,安装python,创建虚拟环境,更新pip和setuptools

python3 -m venv venv_2 # 此处 venv_2 也是自定义的虚拟环境名字

退出虚拟环境deactivate

进入虚拟环境source ~/ansible/bin/activate

pip install --upgrade pip

2、在线安装ansible

pip install ansible

或者pip install ansible==版本号 pip install ansible==2.9.10

3、导出ansible需要的文件

pip freeze>requirements.txt

4、下载上述文件对应的包

pip download -r requirements.txt -d ./pip_packages 或者

pip download -d PIPDIR -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

d指定导出的文件夹

复制代码
 -r指定根据哪一个文件导出

 -i表示使用阿里源(当然可以使用其他国内源啊)
 --trusted-host表示信任主机
5、把包放入离线环境,然后执行如下命令安装ansible的包

pip install --no-index --find-links=./ -r requirements.txt

相关推荐
cup1115 小时前
[技术复盘] Windows Python 打包实战:Nuitka 环境踩坑总结与 CI 自动化构建全指南
python·ai·环境变量·ci·nuitka·skill
aqi0017 小时前
15天学会AI应用开发(七)有了大模型为什么还要引入RAG
人工智能·python·大模型·ai编程·ai应用
金銀銅鐵19 小时前
用 Python 实现 Take-Away 游戏
python·游戏
copyer_xyf20 小时前
Agent 流程编排
后端·python·agent
copyer_xyf20 小时前
Agent RAG
后端·python·agent
copyer_xyf20 小时前
【RAG】向量数据库:milvus
后端·python·agent
copyer_xyf21 小时前
Agent 记忆管理
后端·python·agent
星云穿梭1 天前
用Python写一个带图形界面的学生管理系统——完整教程
python
金銀銅鐵1 天前
用 Pygame 实现 15 puzzle
python·数学·游戏