diff --git a/IPython/core/interactiveshell.py b/IPython/core/interactiveshell.py index 31b1b2f..1b13c98 100644 --- a/IPython/core/interactiveshell.py +++ b/IPython/core/interactiveshell.py @@ -716,7 +716,9 @@ class InteractiveShell(SingletonConfigurable): # Not in a virtualenv return - if sys.executable.startswith(os.environ['VIRTUAL_ENV']): + if os.path.realpath(sys.executable).startswith( + os.path.realpath(os.environ['VIRTUAL_ENV']) + ): # Running properly in the virtualenv, don't need to do anything return