3 examples of 'pycharm virtualenv' in Python

Every line of 'pycharm virtualenv' 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
this disclaimer
82def create_virtualenv(self, no_site_packages=True):
83 """Creates the virtual environment and installs PIP.
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

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

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']))
117@patch.object(os, 'getenv', return_value='')
118def test_get_virtualenv_without_virtualenv(self, os_mock):
119 """
120 Calling get_virtualenv without being in a virtualenv
121 should raise an exception
122 """
123 with self.assertRaises(core.VirtualenvError):
124 core.get_virtualenv()

Related snippets