行业资讯
📅 2026/7/10 7:51:23
2. 进阶,基础环境搭建
conda下载安装我们下载python3.12.13版本的作为base基础版版本下载地址:官网下载地址: 由于墙的原因现在可能访问不了国内镜像加速站:下面为miniconda下载镜像下载地址:可以看到大概的一个python版本:https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/我们下载这个版本:Miniconda3-py312_26.5.3-1-Linux-x86_64.sh其中: 26.5.3-1的意思是: 26年wget -c https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py312_26.5.3-1-Linux-x86_64.sh由于现在墙的原因国外conda源是访问不了的。# 1. 安装 Minicondachmod x Miniconda3-py312_26.5.3-1-Linux-x86_64.shbash Miniconda3-py312_26.5.3-1-Linux-x86_64.sh -b -p $HOME/miniconda3初始化conda:# 假设安装路径为 ~/miniconda3请根据实际安装路径调整~/miniconda3/bin/conda init或:$HOME/miniconda3/bin/conda init bashfengjh4ubuntu-24:~$ $HOME/miniconda3/bin/conda init bashno change /home/fengjh4/miniconda3/condabin/condano change /home/fengjh4/miniconda3/bin/condano change /home/fengjh4/miniconda3/bin/activateno change /home/fengjh4/miniconda3/bin/deactivateno change /home/fengjh4/miniconda3/etc/profile.d/conda.shno change /home/fengjh4/miniconda3/etc/fish/conf.d/conda.fishno change /home/fengjh4/miniconda3/shell/condabin/Conda.psm1no change /home/fengjh4/miniconda3/shell/condabin/conda-hook.ps1no change /home/fengjh4/miniconda3/lib/python3.12/site-packages/xontrib/conda.xshno change /home/fengjh4/miniconda3/etc/profile.d/conda.cshmodified /home/fengjh4/.bashrc For changes to take effect, close and re-open your current shell. 该命令会自动检测你的 Shellbash/zsh等并将必要的配置代码添加到 ~/.bashrc 或 ~/.zshrc 中。source ~/.bashrc验证安装:conda --versionpython --version# 2. 初始化并重启终端source ~/miniconda3/bin/activateconda init# 3. 精准安装 Python 3.12.13conda install -n base python3.12.13 -y# 先配置国内源不联网也能设置conda config --remove-key channels # 清空默认源conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/main/conda config --set show_channel_urls yes# 再试conda create -n python3.11.11 python3.11.11 -y# 1. 添加国内镜像源 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/main/conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/free/# 2. 设置搜索时显示通道地址可选 conda config --set show_channel_urls yes# 3. 现在创建环境自动走国内源 conda create -n python3.11.11 python3.11.11 -yconda create -n python3.12.13 python3.12.13 -yconda activate python3.12.13conda activate python3.12.13python --version卸载conda1. 切换到miniconda目录下:执行uninstall.sh脚本2. vim .bashrc# conda initialize # !! Contents within this block are managed by conda init !!__conda_setup$(/home/fengjh4/miniconda3/bin/conda shell.bash hook 2 /dev/null)if [ $? -eq 0 ]; theneval $__conda_setupelseif [ -f /home/fengjh4/miniconda3/etc/profile.d/conda.sh ]; then. /home/fengjh4/miniconda3/etc/profile.d/conda.shelseexport PATH/home/fengjh4/miniconda3/bin:$PATHfifiunset __conda_setup# conda initialize source .bashrc3. 退出shell重新登陆即可华为ubuntu下载地址:https://mirrors.huaweicloud.com/ubuntu-releases/24.04/抓包分析:sudo apt install libpcap-dev