Show More
@@ -732,6 +732,16 b' class InteractiveShell(SingletonConfigurable):' | |||||
732 | # Not in a virtualenv |
|
732 | # Not in a virtualenv | |
733 | return |
|
733 | return | |
734 |
|
734 | |||
|
735 | # Handle no symbolic link case first. | |||
|
736 | if not os.path.islink(sys.executable): | |||
|
737 | # Adapted from pip.locations.running_under_virtualenv | |||
|
738 | if hasattr(sys, 'real_prefix'): | |||
|
739 | # Running properly in a virtualenv | |||
|
740 | return | |||
|
741 | elif sys.prefix != getattr(sys, "base_prefix", sys.prefix): | |||
|
742 | # Running properly in a venv | |||
|
743 | return | |||
|
744 | ||||
735 | # venv detection: |
|
745 | # venv detection: | |
736 | # stdlib venv may symlink sys.executable, so we can't use realpath. |
|
746 | # stdlib venv may symlink sys.executable, so we can't use realpath. | |
737 | # but others can symlink *to* the venv Python, so we can't just use sys.executable. |
|
747 | # but others can symlink *to* the venv Python, so we can't just use sys.executable. |
General Comments 0
You need to be logged in to leave comments.
Login now