Skip to content

Commit

Permalink
Use sys.executable when executing virtualenv. Resolves #208.
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile committed Mar 29, 2015
1 parent c4ff9d4 commit fbf86c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pre_commit/languages/python.py
Expand Up @@ -3,6 +3,7 @@
import contextlib
import distutils.spawn
import os
import sys

import virtualenv

Expand Down Expand Up @@ -43,7 +44,10 @@ def install_environment(repo_cmd_runner, version='default'):

# Install a virtualenv
with clean_path_on_failure(repo_cmd_runner.path(ENVIRONMENT_DIR)):
venv_cmd = ['virtualenv', '{{prefix}}{0}'.format(ENVIRONMENT_DIR)]
venv_cmd = [
sys.executable, '-m', 'virtualenv',
'{{prefix}}{0}'.format(ENVIRONMENT_DIR)
]
if version != 'default':
venv_cmd.extend(['-p', norm_version(version)])
repo_cmd_runner.run(venv_cmd)
Expand Down

0 comments on commit fbf86c7

Please sign in to comment.