Skip to content

Commit

Permalink
Merge pull request #2972 from pypa/fix-virtualenv-install
Browse files Browse the repository at this point in the history
Fix virtualenv installation
  • Loading branch information
techalchemy committed Oct 9, 2018
2 parents c1f8a62 + b06ba8b commit ddb40ec
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pipenv/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ def spinner():

def which(command, location=None, allow_global=False):
if not allow_global and location is None:
location = project.virtualenv_location or os.environ.get("VIRTUAL_ENV", "")
if not (location and os.path.exists(location)):
raise RuntimeError("virtualenv not created nor specified")
if project.virtualenv_exists:
location = project.virtualenv_location
else:
location = os.environ.get("VIRTUAL_ENV", None)
if not (location and os.path.exists(location)) and not allow_global:
raise RuntimeError("location not created nor specified")
if not allow_global:
if os.name == "nt":
p = find_windows_executable(os.path.join(location, "Scripts"), command)
Expand Down Expand Up @@ -2325,6 +2328,7 @@ def do_check(
def do_graph(bare=False, json=False, json_tree=False, reverse=False):
import pipdeptree


try:
python_path = which("python")
except AttributeError:
Expand Down

0 comments on commit ddb40ec

Please sign in to comment.