Activating a VirtualEnv using a shell script doesn't seem to work

后端 未结 5 1756
孤独总比滥情好
孤独总比滥情好 2020-12-23 19:16

I tried activating a VirtualEnv through a shell script like the one below but it doesn\'t seem to work,

#!/bin/sh
source ~/.virtualenvs/pinax-env/bin/activa         


        
5条回答
  •  庸人自扰
    2020-12-23 20:03

    For me best way work as below.

    Create start-my-py-software.sh and pest below code

    #!/bin/bash
    source "/home/snippetbucket.com/source/AIML-Server-CloudPlatform/bin/activate"
    python --version
    python /home/snippetbucket.com/source/AIML-Server-CloudPlatform/main.py
    

    Give file permission to run like below.

    chmod +x start-my-py-software.sh
    

    Now run like below

    .start-my-py-software.sh
    

    and that's it, start my python based server or any other code.

    ubuntu #18.0

提交回复
热议问题