Skip to content

Running scripts with /usr/bin/env and 2021.11.5.post0 fails to find correct python #4831

Description

@mgmarino

Issue description

This is another regression of the recent release. The problem is running scripts using a she-bang + /usr/bin/env python to reference python. For example:

#!/usr/bin/env python

import sys

print(sys.version)

Running this as executable with the recent stable version of pipenv yields what is expected:

> pipenv --version
pipenv, version 2021.5.29
> pipenv run ./test.py
3.7.9 (default, Nov 16 2020, 11:56:37)
[Clang 12.0.0 (clang-1200.0.32.21)]

With the new version, it keeps the "default" environment (here 2.7 on a mac)

> pipenv --version
pipenv, version 2021.11.5.post0
> pipenv run ./test.py
2.7.17 (default, Dec 23 2019, 21:25:34)
[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.16)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions