# Buggy code
def do_create_virtualenv(python=None, site_packages=False):
    """Creates a virtualenv."""

    click.echo(
        crayons.normal("Creating a virtualenv for this project…", bold=True), err=True
    )

    # The user wants the virtualenv in the project.
    if PIPENV_VENV_IN_PROJECT:
        cmd = [
            "virtualenv",
            project.virtualenv_location,
            "--prompt=({0})".format(project.name),
        ]

        # Pass site-packages flag to virtualenv, if desired...
        if site_packages:
            cmd.append("--system-site-packages")
    else:
        # Default: use pew.
        cmd = [sys.executable, "-m", "pipenv.pew", "new", project.virtualenv_name, "-d"]

    # Pass a Python version to virtualenv, if needed.
    if python:
        click.echo(
            "{0} {1} {2}".format(
                crayons.normal("Using", bold=True),
                crayons.red(python, bold=True),
                crayons.normal("to create virtualenv…", bold=True),
            ),
            err=True,
        )

    # Use virtualenv's -p python.
    if python:
        cmd = cmd + ["-p", python]

    # Actually create the virtualenv.
    with spinner():
        try:
            c = delegator.run(cmd, block=False, timeout=PIPENV_TIMEOUT)
        except OSError:
            click.echo(
                "{0}: it looks like {1} is not in your {2}. "
                "We cannot continue until this is resolved."
                "".format(
                    crayons.red("Warning", bold=True),
                    crayons.red(cmd[0]),
                    crayons.normal("PATH", bold=True),
                ),
                err=True,
            )
            sys.exit(1)

    click.echo(crayons.blue(c.out), err=True)

    # Enable site-packages, if desired...
    if not PIPENV_VENV_IN_PROJECT and site_packages:
        click.echo(
            crayons.normal("Making site-packages available…", bold=True), err=True
        )

        os.environ["VIRTUAL_ENV"] = project.virtualenv_location
        delegator.run("pipenv run pewtwo toggleglobalsitepackages")
        del os.environ["VIRTUAL_ENV"]

    # Say where the virtualenv is.
    do_where(virtualenv=True, bare=False)


# Traceback (FileNotFoundError)
---> Running in e0eedb80adab
+ pipenv install --deploy --system

Installing dependencies from Pipfile.lock (1c8a85)…
Traceback (most recent call last):
File "/usr/bin/pipenv", line 11, in <module>
load_entry_point('pipenv==11.1.4', 'console_scripts', 'pipenv')()
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3/dist-packages/pipenv/cli.py", line 197, in install
selective_upgrade=selective_upgrade
File "/usr/lib/python3/dist-packages/pipenv/core.py", line 1836, in do_install
pre=pre, requirements_dir=requirements_directory
File "/usr/lib/python3/dist-packages/pipenv/core.py", line 1373, in do_init
requirements_dir=requirements_dir.name)
File "/usr/lib/python3/dist-packages/pipenv/core.py", line 857, in do_install_dependencies
requirements_dir=requirements_dir
File "/usr/lib/python3/dist-packages/pipenv/core.py", line 1474, in pip_install
c = delegator.run(pip_command, block=block)
File "/usr/lib/python3/dist-packages/pipenv/vendor/delegator.py", line 267, in run
c.run(block=block, binary=binary)
File "/usr/lib/python3/dist-packages/pipenv/vendor/delegator.py", line 156, in run
s = PopenSpawn(self._popen_args, **pexpect_kwargs)
File "/usr/lib/python3/dist-packages/pipenv/vendor/pexpect/popen_spawn.py", line 46, in __init__
self.proc = subprocess.Popen(cmd, **kwargs)
File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/bin/pip': '/bin/pip'

# Fixed code
def do_create_virtualenv(python=None, site_packages=False):
    """Creates a virtualenv."""

    click.echo(
        crayons.normal("Creating a virtualenv for this project…", bold=True), err=True
    )

    # The user wants the virtualenv in the project.
    if PIPENV_VENV_IN_PROJECT:
        cmd = [
            "virtualenv",
            project.virtualenv_location,
            "--prompt=({0})".format(project.name),
        ]

        # Pass site-packages flag to virtualenv, if desired...
        if site_packages:
            cmd.append("--system-site-packages")
    else:
        # Default: use pew.
        cmd = [sys.executable, "-m", "pipenv.pew", "new", project.virtualenv_name, "-d"]

    if not python:
        python = (
            find_a_system_python("3.6") or find_a_system_python("3") or sys.executable
        )

    click.echo(
        "{0} {1} {2}".format(
            crayons.normal("Using", bold=True),
            crayons.red(python, bold=True),
            crayons.normal("to create virtualenv…", bold=True),
        ),
        err=True,
    )

    cmd = cmd + ["-p", python]

    # Actually create the virtualenv.
    with spinner():
        try:
            c = delegator.run(cmd, block=False, timeout=PIPENV_TIMEOUT)
        except OSError:
            click.echo(
                "{0}: it looks like {1} is not in your {2}. "
                "We cannot continue until this is resolved."
                "".format(
                    crayons.red("Warning", bold=True),
                    crayons.red(cmd[0]),
                    crayons.normal("PATH", bold=True),
                ),
                err=True,
            )
            sys.exit(1)

    click.echo(crayons.blue(c.out), err=True)

    # Enable site-packages, if desired...
    if not PIPENV_VENV_IN_PROJECT and site_packages:
        click.echo(
            crayons.normal("Making site-packages available…", bold=True), err=True
        )

        os.environ["VIRTUAL_ENV"] = project.virtualenv_location
        delegator.run("pipenv run pewtwo toggleglobalsitepackages")
        del os.environ["VIRTUAL_ENV"]

    # Say where the virtualenv is.
    do_where(virtualenv=True, bare=False)