How to install a Python package from within IPython?

后端 未结 5 1264
遥遥无期
遥遥无期 2020-11-27 14:01

I wonder if it\'s possible to install python packages without leaving the IPython shell.

5条回答
  •  鱼传尺愫
    2020-11-27 14:50

    The accepted answer by aculich will not work in all circumstances, for example:

    • If you installed ipython/jupyter in a venv and run it directly via the venv's python binary
    • If you have multiple python versions, like EntryLevelR.

    The correct command is:

    import sys
    !{sys.executable} -m pip install requests
    

提交回复
热议问题