"Could not call install_name_tool -- you must have Apple's development tools installed")

raise

# Some tools depend on pythonX.Y being present

py_executable_version ='%s.%s'% (

sys.version_info[0], sys.version_info[1])

ifnot py_executable.endswith(py_executable_version):

# symlinking pythonX.Y > python

pth = py_executable +'%s.%s'% (

sys.version_info[0], sys.version_info[1])

if os.path.exists(pth):

os.unlink(pth)

os.symlink('python', pth)

else:

# reverse symlinking python -> pythonX.Y (with --python)

pth = join(bin_dir, 'python')

if os.path.exists(pth):

os.unlink(pth)

os.symlink(os.path.basename(py_executable), pth)

if sys.platform =='win32'and''in py_executable:

# There's a bug with subprocess on Windows when using a first

# argument that has a space in it. Instead we have to quote

# the value:

py_executable ='"%s"'% py_executable

cmd = [py_executable, '-c', """

import sys

prefix = sys.prefix

if sys.version_info[0] == 3:

prefix = prefix.encode('utf8')

if hasattr(sys.stdout, 'detach'):

sys.stdout = sys.stdout.detach()

elif hasattr(sys.stdout, 'buffer'):

sys.stdout = sys.stdout.buffer

sys.stdout.write(prefix)

"""]

logger.info('Testing executable with %s%s "%s"'%tuple(cmd))

try:

proc = subprocess.Popen(cmd,

stdout=subprocess.PIPE)

proc_stdout, proc_stderr = proc.communicate()

exceptOSError:

e = sys.exc_info()[1]

if e.errno == errno.EACCES:

logger.fatal('ERROR: The executable %s could not be run: %s'% (py_executable, e))

sys.exit(100)

else:

raise e

proc_stdout = proc_stdout.strip().decode("utf-8")

proc_stdout = os.path.normcase(os.path.abspath(proc_stdout))

norm_home_dir = os.path.normcase(os.path.abspath(home_dir))

ifhasattr(norm_home_dir, 'decode'):

norm_home_dir = norm_home_dir.decode(sys.getfilesystemencoding())

if proc_stdout != norm_home_dir:

logger.fatal(

'ERROR: The executable %s is not functioning'% py_executable)

logger.fatal(

'ERROR: It thinks sys.prefix is %r (should be %r)'

% (proc_stdout, norm_home_dir))

logger.fatal(

'ERROR: virtualenv is not compatible with this system or executable')

if sys.platform =='win32':

logger.fatal(

'Note: some Windows users have reported this error when they installed Python for "Only this user". The problem may be resolvable if you install Python "For all users". (See https://bugs.launchpad.net/virtualenv/+bug/352844)')

sys.exit(100)

else:

logger.info('Got sys.prefix result: %r'% proc_stdout)

pydistutils = os.path.expanduser('~/.pydistutils.cfg')

if os.path.exists(pydistutils):

logger.notify('Please make sure you remove any previous custom paths from '