# Buggy code
def create_pipfile(self, python=None):
    """Creates the Pipfile, filled with juicy defaults."""
    config_parser = ConfigOptionParser(name=self.name)
    install = dict(config_parser.get_config_section("install"))
    indexes = install.get("extra-index-url", "").lstrip("\n").split("\n")

    if PIPENV_TEST_INDEX:
        sources = [{"url": PIPENV_TEST_INDEX, "verify_ssl": True, "name": "custom"}]
    else:
        # Default source.
        pypi_source = {
            "url": "https://pypi.python.org/simple",
            "verify_ssl": True,
            "name": "pypi",
        }
        sources = [pypi_source]

        for i, index in enumerate(indexes):
            if not index:
                continue
            source_name = "pip_index_{}".format(i)
            verify_ssl = index.startswith("https")

            sources.append(
                {"url": index, "verify_ssl": verify_ssl, "name": source_name}
            )

    data = {
        "source": sources,
        # Default packages.
        "packages": {},
        "dev-packages": {},
    }

    # Default requires.
    data["requires"] = {
        "python_version": python_version(self.which("python"))[: len("2.7")]
    }

    self.write_toml(data, "Pipfile")


# 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 create_pipfile(self, python=None):
    """Creates the Pipfile, filled with juicy defaults."""
    config_parser = ConfigOptionParser(name=self.name)
    install = dict(config_parser.get_config_section("install"))
    indexes = install.get("extra-index-url", "").lstrip("\n").split("\n")

    if PIPENV_TEST_INDEX:
        sources = [{"url": PIPENV_TEST_INDEX, "verify_ssl": True, "name": "custom"}]
    else:
        # Default source.
        pypi_source = {
            "url": "https://pypi.python.org/simple",
            "verify_ssl": True,
            "name": "pypi",
        }
        sources = [pypi_source]

        for i, index in enumerate(indexes):
            if not index:
                continue
            source_name = "pip_index_{}".format(i)
            verify_ssl = index.startswith("https")

            sources.append(
                {"url": index, "verify_ssl": verify_ssl, "name": source_name}
            )

    data = {
        "source": sources,
        # Default packages.
        "packages": {},
        "dev-packages": {},
    }

    # Default requires.
    required_python = (
        python if python else self.which("python", self.virtualenv_location)
    )
    data["requires"] = {"python_version": python_version(required_python)[: len("2.7")]}

    self.write_toml(data, "Pipfile")