自动载入Python虚拟环境
阅读原文时间:2023年09月27日阅读:1

自动载入Python虚拟环境

在安装jumpserver服务时发现可以使用autoenv来自动载入python虚拟环境,很好,非常好。

$ cd /opt
$ git clone https://github.com/kennethreitz/autoenv.git
$ echo 'source /opt/autoenv/activate.sh' >> ~/.bashrc
$ source ~/.bashrc

使用

$ cd /opt/
$ git clone https://github.com/jumpserver/jumpserver.git
$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env # 进入 jumpserver 目录时将自动载入 python 虚拟环境

首次进入 jumpserver 文件夹会有提示,按 y 即可

Are you sure you want to allow this? (y/N) y