在 ipython 中运行 python 脚本 [英] Running python script inside ipython
本文介绍了在 ipython 中运行 python 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以在不指明路径的情况下从 ipython 内部运行 python 脚本(不是模块)?我试图设置 PYTHONPATH 但它似乎只适用于模块.我想执行
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 like to execute
%run my_script.py
不在包含文件的目录中.
without being in the directory containing the file.
推荐答案
从my_script.py"目录中你可以简单地做:
from within the directory of "my_script.py" you can simply do:
%run ./my_script.py
这篇关于在 ipython 中运行 python 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文