Running python script inside ipython Ask Question

Running python script inside ipython Ask Question

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.

ベストアンサー1

from within the directory of "my_script.py" you can simply do:

%run ./my_script.py

おすすめ記事