9 examples of 'activate venv python' in Python

Every line of 'activate venv python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
82def activate_virtualenv(venv):
83 """Activate a virtualenv in the current Python process."""
84 with open(venv['activate_this']) as f:
85 exec(f.read(), dict(__file__=venv['activate_this']))
854def do_activate_virtualenv(bare=False):
855 """Executes the activate virtualenv functionality."""
856 # Check for environment marker, and skip if it's set.
857 if 'PIPENV_ACTIVE' not in os.environ:
858 if not bare:
859 click.echo('To activate this project\'s virtualenv, run the following:\n $ {0}'.format(
860 crayons.red('pipenv shell'))
861 )
862 else:
863 click.echo(activate_virtualenv())
174def _set_virtualenv(self, index):
175 if index != -1:
176 venv = self.available_venvs[index][1]
177 self.set_virtualenv(venv)
43def activate(self):
44 if not self._initialized:
45 self.initialize()
46 activate_virtualenv(self._root)
17def main(modules):
18 venv = get_active_venv()
19 if venv is None:
20 print "No virtual envs"
21 return
22 site_path = get_sitepackages_path(venv)
23 easy_install_file = get_easy_install_pth(site_path)
24
25 for m in modules:
26 link_module(m, site_path, easy_install_file)
23@property
24def python(self):
25 return self.get_binary('python')
1525def inline_activate_virtualenv():
1526 try:
1527 activate_this = which('activate_this.py')
1528 with open(activate_this) as f:
1529 code = compile(f.read(), activate_this, 'exec')
1530 exec(code, dict(__file__=activate_this))
1531 # Catch all errors, just in case.
1532 except Exception:
1533 click.echo(
1534 '{0}: There was an unexpected error while activating your virtualenv. Continuing anyway…'
1535 ''.format(crayons.red('Warning', bold=True)),
1536 err=True
1537 )
82def create_virtualenv(self, no_site_packages=True):
83 """Creates the virtual environment and installs PIP.
84
85 Creates the virtual environment and installs PIP only into the
86 virtual environment.
87 """
88 if not os.path.isdir(self.venv):
89 print 'Creating venv...',
90 if no_site_packages:
91 self.run_command(['virtualenv', '-q', '--no-site-packages',
92 self.venv])
93 else:
94 self.run_command(['virtualenv', '-q', self.venv])
95 print 'done.'
96 print 'Installing pip in venv...',
97 if not self.run_command(['tools/with_venv.sh', 'easy_install',
98 'pip>1.0']).strip():
99 self.die("Failed to install pip.")
100 print 'done.'
101 else:
102 print "venv already exists..."
103 pass
16def _inline_activate_virtualenv():
17 try:
18 activate_this = which('activate_this.py')
19 if not activate_this or not os.path.exists(activate_this):
20 click.echo(
21 u'{0}: activate_this.py not found. Your environment is most '
22 u'certainly not activated. Continuing anyway...'
23 u''.format(crayons.red('Warning', bold=True)),
24 err=True,
25 )
26 return
27 with open(activate_this) as f:
28 code = compile(f.read(), activate_this, 'exec')
29 exec(code, dict(__file__=activate_this))
30 # Catch all errors, just in case.
31 except Exception:
32 click.echo(
33 u'{0}: There was an unexpected error while activating your virtualenv. Continuing anyway...'
34 ''.format(crayons.red('Warning', bold=True)),
35 err=True,
36 )

Related snippets