Sharing scripts that require a virtualenv to be activated

后端 未结 3 432
醉酒成梦
醉酒成梦 2021-02-02 07:21

I have virtualenv and virtualenvwrapper installed on a shared Linux server with default settings (virtualenvs are in ~/.virtualenvs). I have several Python scripts that can onl

3条回答
  •  野性不改
    2021-02-02 07:36

    Use the following magic(5) at the start of the script.

    #!/usr/bin/env python
    

    Change which virtualenv is active and it'll use the python from that virtualenv. Deactivate the virtualenv, it still runs.

提交回复
热议问题