自动载入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

  

相关文章:

  • 2021-12-14
  • 2022-01-10
猜你喜欢
  • 2021-12-04
  • 2021-11-23
  • 2021-05-24
  • 2021-08-19
  • 2021-11-13
  • 2021-12-10
  • 2021-06-18
相关资源
相似解决方案