简体   繁体   中英

Executing Ipython Script from System Shell

In the same way we can execute regular Python using shebangs (or PyLauncher on windows), can we do the same with Ipython and .ipy files?

Registering IPython in Windows registry so double-click .ipy launches IPython Console. Or from linux just adding an 'i' to '/usr/bin/python' and execute.

In Windows this would be really helpful, because one of the trickest parts of "system integration" is the command line arguments. If these could be tucked into a text file on the shebang (pylauncher style), that would be fabulous.

Not sure if I fully understand your problem, but you can create a py.ini file on Windows as described in the Customized Commands section of PEP 397 of which PyLauncher is an implementation.

[commands]
ipython=C:\Anaconda\Scripts\ipython.exe -v

Changing the path to where your local IPython is installed. If you associate the .ipy file extension with the pylauncher executable ( typically C:\\Windows\\py.exe and you can save the py.ini file to the same path ) and use the shebang below at the top of your .py/.ipy files they should run with ipython and the options specified in the py.ini file

#! ipython

You can also associate the ipython.exe with .ipy files on Windows and it will run the .ipy files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM