本文整理汇总了Python中venv.main方法的典型用法代码示例。如果您正苦于以下问题:Python venv.main方法的具体用法?Python venv.main怎么用?Python venv.main使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类venv
的用法示例。
在下文中一共展示了venv.main方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import venv [as 别名]
# 或者: from venv import main [as 别名]
def run(self):
venv_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'venv', 'nginx-config-builder')
print('Creating virtual environment in {path}'.format(path=venv_path))
if '3' in self.python or sys.version_info[0] >= 3:
import venv
venv.main(args=[venv_path])
else:
venv_cmd = ['virtualenv']
if self.python:
venv_cmd.extend(['-p', self.python])
venv_cmd.append(venv_path)
subprocess.check_call(venv_cmd)
print('Linking `activate` to top level of project.\n')
print('To activate, simply run `source activate`.')
try:
os.symlink(
os.path.join(venv_path, 'bin', 'activate'),
os.path.join(os.path.dirname(os.path.abspath(__file__)), 'activate')
)
except OSError:
# symlink already exists
pass
示例2: run_tests
# 需要导入模块: import venv [as 别名]
# 或者: from venv import main [as 别名]
def run_tests(self):
import tox
errno = -1
try:
tox.session.main()
except SystemExit as e:
errno = e.code
sys.exit(errno)
示例3: run
# 需要导入模块: import venv [as 别名]
# 或者: from venv import main [as 别名]
def run(self):
venv_path = Path(__file__).absolute().parent / 'venv' / 'asciietch'
print(f'Creating virtual environment in {venv_path}')
venv.main(args=[str(venv_path)])
print(
'Linking `activate` to top level of project.\n'
'To activate, simply run `source activate`.'
)
activate = Path(venv_path, 'bin', 'activate')
activate_link = Path(__file__).absolute().parent / 'activate'
try:
activate_link.symlink_to(activate)
except FileExistsError:
...
示例4: run
# 需要导入模块: import venv [as 别名]
# 或者: from venv import main [as 别名]
def run(self):
venv_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'venv', 'shiv')
print('Creating virtual environment in {}'.format(venv_path))
venv.main(args=[venv_path])
print(
'Linking `activate` to top level of project.\n'
'To activate, simply run `source activate`.'
)
try:
os.symlink(
Path(venv_path, 'bin', 'activate'),
Path(Path(__file__).absolute().parent, 'activate'),
)
except FileExistsError:
pass