[英]Automatically execute commands on launching python shell
I was wondering if there is a way to automatically run commands on entering the python shell as you would with the .bash_profile or .profile scripts with bash. 我想知道是否有一种方法可以自动运行命令进入python shell,就像使用bash的.bash_profile或.profile脚本一样。 I would like to automatically import some modules so I don't have to type the whole shebang everytime I hop into the shell.
我想自动导入一些模块,所以每次进入shell时我都不必输入整个shebang。
Thanks, 谢谢,
是的,你可以使用PYTHONSTARTUP
环境变量来做到这一点所概述这里
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.