Show More
@@ -903,12 +903,12 b' class InteractiveShell(SingletonConfigurable):' | |||||
903 | if 'VIRTUAL_ENV' not in os.environ: |
|
903 | if 'VIRTUAL_ENV' not in os.environ: | |
904 | # Not in a virtualenv |
|
904 | # Not in a virtualenv | |
905 | return |
|
905 | return | |
906 |
elif os.environ[ |
|
906 | elif os.environ["VIRTUAL_ENV"] == "": | |
907 | warn("Virtual env path set to '', please check if this is intended.") |
|
907 | warn("Virtual env path set to '', please check if this is intended.") | |
908 | return |
|
908 | return | |
909 |
|
909 | |||
910 | p = Path(sys.executable) |
|
910 | p = Path(sys.executable) | |
911 |
p_venv = Path(os.environ[ |
|
911 | p_venv = Path(os.environ["VIRTUAL_ENV"]) | |
912 |
|
912 | |||
913 | # fallback venv detection: |
|
913 | # fallback venv detection: | |
914 | # stdlib venv may symlink sys.executable, so we can't use realpath. |
|
914 | # stdlib venv may symlink sys.executable, so we can't use realpath. | |
@@ -920,9 +920,9 b' class InteractiveShell(SingletonConfigurable):' | |||||
920 | paths.append(p.resolve()) |
|
920 | paths.append(p.resolve()) | |
921 |
|
921 | |||
922 | # In Cygwin paths like "c:\..." and '\cygdrive\c\...' are possible |
|
922 | # In Cygwin paths like "c:\..." and '\cygdrive\c\...' are possible | |
923 |
if str(p_venv).startswith( |
|
923 | if str(p_venv).startswith("\\cygdrive"): | |
924 | p_venv = Path(str(p_venv)[11:]) |
|
924 | p_venv = Path(str(p_venv)[11:]) | |
925 |
elif len(str(p_venv)) >= 2 and str(p_venv)[1] == |
|
925 | elif len(str(p_venv)) >= 2 and str(p_venv)[1] == ":": | |
926 | p_venv = Path(str(p_venv)[2:]) |
|
926 | p_venv = Path(str(p_venv)[2:]) | |
927 |
|
927 | |||
928 | if any(os.fspath(p_venv) in os.fspath(p) for p in paths): |
|
928 | if any(os.fspath(p_venv) in os.fspath(p) for p in paths): | |
@@ -932,15 +932,12 b' class InteractiveShell(SingletonConfigurable):' | |||||
932 | warn("Attempting to work in a virtualenv. If you encounter problems, please " |
|
932 | warn("Attempting to work in a virtualenv. If you encounter problems, please " | |
933 | "install IPython inside the virtualenv.") |
|
933 | "install IPython inside the virtualenv.") | |
934 | if sys.platform == "win32": |
|
934 | if sys.platform == "win32": | |
935 |
virtual_env = Path(os.environ[ |
|
935 | virtual_env = Path(os.environ["VIRTUAL_ENV"]).joinpath( | |
936 |
|
|
936 | "Lib", "site-packages" | |
937 | 'site-packages' |
|
|||
938 | ) |
|
937 | ) | |
939 | else: |
|
938 | else: | |
940 |
virtual_env = Path(os.environ[ |
|
939 | virtual_env = Path(os.environ["VIRTUAL_ENV"]).joinpath( | |
941 | 'lib', |
|
940 | "lib", "python{}.{}".format(*sys.version_info[:2]), "site-packages" | |
942 | "python{}.{}".format(*sys.version_info[:2]), |
|
|||
943 | 'site-packages' |
|
|||
944 | ) |
|
941 | ) | |
945 |
|
942 | |||
946 | import site |
|
943 | import site |
General Comments 0
You need to be logged in to leave comments.
Login now