6 examples of 'create conda environment with specific python version' in Python

Every line of 'create conda environment with specific python version' 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
38def create_env(self, py, args):
39 if py:
40 args = ["--python=%s" % py] + args
41 subprocess.check_call(
42 [sys.executable, '-m', 'virtualenv', str(self.root)] + args,
43 )
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
52def create_virtualenv():
53 "Check if a virtual env existis, if not, create one"
54 sys.stdout.write("Creation of Virtualenv starts.\n")
55 if 'VIRTUAL_ENV' not in os.environ:
56 if not os.access(VIRTUAL_ENV_NAME,os.F_OK):
57 sys.stdout.write('Virtualenv \"%s\" does not exist yet and will now be created.\n' %VIRTUAL_ENV_NAME)
58 #subprocess.call(["virtualenv", VIRTUAL_ENV_NAME, "--no-site-packages"])
59 subprocess.call(['virtualenv', VIRTUAL_ENV_NAME])
60 sys.stdout.write('Virtualenv \"%s\" is now created\n' %VIRTUAL_ENV_NAME)
61 else:
62 sys.stdout.write('Virtualenv \"%s\" already existed and will not be created.\n' %VIRTUAL_ENV_NAME)
63 else:
64 sys.stdout.write('Virtualenv \"%s\" already existed and will not be created.\n' %VIRTUAL_ENV_NAME)
14def test_create_uses_bash_and_sources_virtualenvwrapper(self, mock_subprocess, virtualenvs_folder):
15 v = Virtualenv("domain.com", "3.6")
16 v.create(nuke=False)
17 args, kwargs = mock_subprocess.check_call.call_args
18 command_list = args[0]
19 assert command_list[:2] == ["bash", "-c"]
20 assert command_list[2].startswith("source virtualenvwrapper.sh && mkvirtualenv")
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']))
24def python(self):
25 return self.get_binary('python')

Related snippets