gpt4 book ai didi

python - 在启动 python shell 时自动执行命令

转载 作者:太空狗 更新时间:2023-10-29 21:27:36 25 4
gpt4 key购买 nike

我想知道是否有一种方法可以在进入 python shell 时自动运行命令,就像使用 bash 的 .bash_profile 或 .profile 脚本一样。我想自动导入一些模块,这样我就不必每次进入 shell 时都输入整个 shebang。

谢谢,

最佳答案

是的,您可以使用 PYTHONSTARTUP 环境变量来执行此操作,如 here 所述

关于python - 在启动 python shell 时自动执行命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2587709/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com