virtualenvwrapper functions unavailable in shell scripts

前端 未结 8 781
夕颜
夕颜 2020-12-01 03:44

So, once again, I make a nice python program which makes my life ever the more easier and saves a lot of time. Ofcourse, this involves a virtualenv, made with the mkvi

8条回答
  •  無奈伤痛
    2020-12-01 03:53

    This is a super old thread and I had a similar issue. I started digging for a simpler solution out of curiousity.

    gnome-terminal --working-directory='/home/exact/path/here' --tab --title="API" -- bash -ci "workon aaapi && python manage.py runserver 8001; exec bash;"
    

    The --workingdirectory forces the tab to open there by default under the hood and the -ci forces it to work like an interactive interface, which gets around the issues with the venvwrapper not functioning as expected.

    You can run as many of these in sequence. It will open tabs, give them an alias, and run the script you want.

    Personally I dropped an alias into my bashrc to just do this when I type startdev in my terminal.

    I like this because its easy, simple to replicate, flexible, and doesn't require any fiddling with variables and whatnot.

提交回复
热议问题