Running python script inside ipython

前端 未结 5 964
无人及你
无人及你 2020-12-04 08:08

Is it possible to run a python script (not module) from inside ipython without indicating its path? I tried to set PYTHONPATH but it seems to work only for modules. I would

5条回答
  •  一向
    一向 (楼主)
    2020-12-04 08:38

    How to run a script in Ipython

    import os
    filepath='C:\\Users\\User\\FolderWithPythonScript' 
    os.chdir(filepath)
    %run pyFileInThatFilePath.py
    

    That should do it

提交回复
热议问题