env.py 文件源码

python
阅读 41 收藏 0 点赞 0 评论 0

项目:inmanta 作者: inmanta 项目源码 文件源码
def use_virtual_env(self):
        """
            Use the virtual environment
        """
        if not self.init_env():
            raise Exception("Unable to init virtual environment")

        activate_file = os.path.join(self.env_path, "bin/activate_this.py")
        if os.path.exists(activate_file):
            with open(activate_file) as f:
                code = compile(f.read(), activate_file, 'exec')
                exec(code, {"__file__": activate_file})
        else:
            raise Exception("Unable to activate virtual environment because %s does not exist." % activate_file)

        # patch up pkg
        pkg_resources.working_set = pkg_resources.WorkingSet._build_master()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号