conda搭建python虚拟环境常规操作

下载&安装conda

#下载安装脚本
wget https://repo.anaconda.com/archive/Anaconda3-2022.05-Linux-x86_64.sh --no-check-certificate
#执行安装
bash Anaconda3-2022.05-Linux-x86_64.sh

配置conda环境

#查看用户执行环境
cat ~/.bashrc
...
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/usr/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/usr/etc/profile.d/conda.sh" ]; then
        . "/usr/etc/profile.d/conda.sh"
    else
        export PATH="/usr/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

#加载conda 用户环境
source ~/.bashrc

#关闭终端自动进入base环境
conda config --set auto_activate_base false

#配置源
conda config --remove channels  https://repo.anaconda.com/pkgs/main/linux-64
conda config --remove channels https://repo.anaconda.com/pkgs/main/noarch
conda config --remove channels https://repo.anaconda.com/pkgs/main/linux-64

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

安装python 应用环境

#安装依赖模块 
#virtual(mytest) root@10--1xxx:/home/zhangsan/virtualenv# conda install selenium
(mytest) root@10-1xxx:/home/zhangsan/virtualenv# conda install requests
(mytest) root@10-1xxx:/home/zhangsan/virtualenv# conda install xlrd
(mytest) root@10-1xxx:/home/zhangsan/virtualenv# conda uninstall xlrd
(mytest) root@10-1xxx:/home/zhangsan/virtualenv# conda  install xlrd==1.2.0

#内部无法安装,则可尝试在绝对路径安装
(mytest) root@10-1xxx:/home/zhangsan/virtualenv# conda install ddddocr
/Users/zhangsan/miniconda3/envs/mytest/bin/python3.10   -m pip install html_table  --trusted-host mirrors.aliyun.com -i https://pypi.tuna.tsinghua.edu.cn/simple

#https://cloud.tencent.com/developer/article/1533282
google-chrome --no-sandbox --headless --disable-gpu --screenshot https://www.baidu.com/

环境查看&激活

#外部安装包
#conda env list

#创建python虚拟环境
conda create -n mytest python=3.10

#激活pyhon环境
source activate mytest

#退出python虚拟环境
conda deactivate
#2
source deactivate base
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇
Secured By miniOrange