What is the proper way to get python module search path?

At least one can run python -c 'import sys; print(sys.path)' to get the python module path.

However, my problem is that I’m using julia with the PyCall package. In Julia, when I run following command:

julia> sys=PyCall.pyimport("sys")
julia> sys.path

the returned result is limited in only python installation directory.

The path of other python packages that has been installed with python3.withPackages do not appear.

My question is that

  1. Is there a way to let Julia PyCall to recognize theses packages (e.g., matplotlb)
  2. If the 1st requirement cannot be fulfilled, can I get a list of python path in a clean way (not by using pthon -c)? then I can feed it to PyCall later.


julia is most likely pointing to a different interpreter than the one present in your environment.

python path issue · Issue #54 · jdlangs/RobotOS.jl · GitHub maybe able to help you