[Python] what does {sys.executable} do in jupyter notebook?

Discussão em 'Python' iniciado por Stack, Maio 10, 2025.

  1. Stack

    Stack Membro Participativo

    I bought a book which comes with jupyter notebook. In the first chapter, it asks me to install required libraries. It use {sys.executable} -m. I never see it before. what does {sys.executable} and -m do? also why use --user at the end?

    typically, I just use ! pip install numpy==1.19.2

    Anyone can help me understand it? Thank you!


    import sys

    !{sys.executable} -m pip install numpy==1.19.2 --user
    !{sys.executable} -m pip install scipy==1.6.2 --user
    !{sys.executable} -m pip install tensorflow==2.4.0 --user
    !{sys.executable} -m pip install tensorflow-probability==0.11.0 --user
    !{sys.executable} -m pip install scikit-learn==0.24.1 --user
    !{sys.executable} -m pip install statsmodels==0.12.2 --user
    !{sys.executable} -m pip install ta --user

    Continue reading...

Compartilhe esta Página