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