diff --git a/pipenv/core.py b/pipenv/core.py index 3758dfb4..321ec588 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1261,6 +1261,7 @@ def do_init( pypi_mirror=None, ): """Executes the init functionality.""" + global PIPENV_VIRTUALENV if not system: if not project.virtualenv_exists: try: @@ -1292,7 +1293,7 @@ def do_init( ) requirements_dir.cleanup() sys.exit(1) - elif system or allow_global: + elif (system or allow_global) and not (PIPENV_VIRTUALENV): click.echo( crayons.red( u'Pipfile.lock ({0}) out of date, but installation ' @@ -1321,7 +1322,7 @@ def do_init( if not project.lockfile_exists and not skip_lock: # Unless we're in a virtualenv not managed by pipenv, abort if we're # using the system's python. - if (system or allow_global) and not PIPENV_VIRTUALENV: + if (system or allow_global) and not (PIPENV_VIRTUALENV): click.echo( '{0}: --system is intended to be used for Pipfile installation, ' 'not installation of specific packages. Aborting.'.format( @@ -1793,6 +1794,7 @@ def do_install( keep_outdated = project.settings.get('keep_outdated') remote = requirements and is_valid_url(requirements) # Warn and exit if --system is used without a pipfile. + global PIPENV_VIRTUALENV if system and package_name and not PIPENV_VIRTUALENV: click.echo( '{0}: --system is intended to be used for Pipfile installation, '