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()
评论列表
文章目录