Commit bd9d2049 authored by Paolo Tosco's avatar Paolo Tosco
Browse files

- fixes a problem in locating jupyter if installed without the --user switch

- fixes a potential library path issue on Linux
parent 997d5518
......@@ -130,9 +130,8 @@ class JupyterNotebookLauncher(object):
JUPYTER_NOTEBOOK_BINARY += ".exe"
jupyter_dirs.update(
set(
os.path.join(os.path.dirname(p), "Scripts")
for p in sys.path
if "site-packages" in p
os.path.join(os.path.dirname(os.path.dirname(p)), "Scripts")
for p in sys.path if "site-packages" in p
)
)
jupyter_dirs.add(os.path.join(os.path.dirname(site.USER_SITE), "Scripts"))
......@@ -168,18 +167,24 @@ class JupyterNotebookLauncher(object):
else:
import_dir += os.pathsep
import_dir += pythonpath
dllpath_dir = None
if sys.platform == "win32":
PATH = "PATH"
dllpath_dir = "PATH"
dll_dir = os.path.dirname(os.path.realpath(sys.executable))
path = env.get(PATH, "")
if path:
path_as_list = pythonpath.split(os.pathsep)
if dll_dir in path_as_list:
elif sys.platform == "linux":
dllpath_dir = "LD_LIBRARY_PATH"
dll_dir = os.path.join(os.path.dirname(
os.path.dirname(os.path.realpath(sys.executable))), "lib")
if dllpath_dir:
dllpath = env.get(dllpath_dir, "")
if dllpath:
pythonpath_as_list = pythonpath.split(os.pathsep)
if dll_dir in pythonpath_as_list:
dll_dir = ""
else:
dll_dir += os.pathsep
dll_dir += path
env[PATH] = dll_dir
dll_dir += dllpath
env[dllpath_dir] = dll_dir
env.update(
{
PYTHONPATH: import_dir,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment