Repository: pypa/pipenv

Issue:
`python -m pipenv.help` broken in 11.10.0
See title. Erroring with `TypeError: format() argument after ** must be a mapping, not NoneType`.

------------

##### Expected result
Help info should be output successfully

##### Actual result
Help info only partially succeeds, before erroring. Example output:
```
$ python -m pipenv.help
<details><summary>$ python -m pipenv.help output</summary>
Pipenv version: `'11.10.0'`
Pipenv location: `'/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/pipenv'`
Python location: `'/home/travis/virtualenv/python3.6.3/bin/python'`
Other Python installations in `PATH`:
  - `2.7`: `/opt/pyenv/shims/python2.7`
  - `2.7`: `/opt/pyenv/shims/python2.7`
  - `2.7`: `/usr/bin/python2.7`
  - `3.4`: `/usr/bin/python3.4m`
  - `3.4`: `/usr/bin/python3.4`
Traceback (most recent call last):
  File "/opt/python/3.6.3/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/opt/python/3.6.3/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/pipenv/help.py", line 89, in <module>
    main()
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/pipenv/help.py", line 24, in main
    found = find_python_in_path(python_v)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/pipenv/core.py", line 355, in find_python_in_path
    version = python_version(p)
  File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/pipenv/utils.py", line 218, in python_version
    return u'{major}.{minor}.{micro}'.format(**version)
TypeError: format() argument after ** must be a mapping, not NoneType
The command "python -m pipenv.help" exited with 1.
```

##### Steps to replicate
Please see minimum-reproducible code at [this repo](https://github.com/murrple-1/pipenv-issue-2), with [this Travis-CI](https://travis-ci.org/murrple-1/pipenv-issue-2).



Discussion:
I broke things again 🤦‍♂️ So sorry about that.
I wonder what causes this on Travis though. One of `python`, `python2`, `python3`, and `py` commands returned something unexpected when passed the `--version` flag.

Resolving patch:
diff --git a/pipenv/project.py b/pipenv/project.py
--- a/pipenv/project.py
+++ b/pipenv/project.py
@@ -44,6 +44,7 @@
     PIPENV_VIRTUALENV,
     PIPENV_TEST_INDEX,
     PIPENV_PYTHON,
+    PIPENV_DEFAULT_PYTHON_VERSION,
 )
 
 
@@ -578,12 +579,17 @@ def create_pipfile(self, python=None):
             u'dev-packages': {},
         }
         # Default requires.
-        required_python = python or self.which(
-            'python', self.virtualenv_location
-        )
-        data[u'requires'] = {
-            'python_version': python_version(required_python)[: len('2.7')]
-        }
+        required_python = python
+        if not python:
+            if self.virtualenv_location:
+                required_python = self.which('python', self.virtualenv_location)
+            else:
+                required_python = self.which('python')
+        version = python_version(required_python) or PIPENV_DEFAULT_PYTHON_VERSION
+        if version and len(version) >= 3:
+            data[u'requires'] = {
+                'python_version': version[: len('2.7')]
+            }
         self.write_toml(data, 'Pipfile')
 
     def write_toml(self, data, path=None):
diff --git a/pipenv/utils.py b/pipenv/utils.py
--- a/pipenv/utils.py
+++ b/pipenv/utils.py
@@ -220,8 +220,13 @@ def python_version(path_to_python):
         c = delegator.run([path_to_python, '--version'], block=False)
     except Exception:
         return None
+    c.block()
     version = parse_python_version(c.out.strip() or c.err.strip())
-    return u'{major}.{minor}.{micro}'.format(**version)
+    try:
+        version = u'{major}.{minor}.{micro}'.format(**version)
+    except TypeError:
+        return None
+    return version
 
 
 def escape_grouped_arguments(s):


Test patch:
diff --git a/tests/unit/test_help.py b/tests/unit/test_help.py
new file mode 100644
--- /dev/null
+++ b/tests/unit/test_help.py
@@ -0,0 +1,11 @@
+import os
+import subprocess
+import sys
+
+
+def test_help():
+    output = subprocess.check_output(
+        [sys.executable, '-m', 'pipenv.help'],
+        stderr=subprocess.STDOUT, env=os.environ.copy(),
+    )
+    assert output