简体   繁体   English

在命令提示符下运行脚本,而后不退出Python

[英]Run script in command prompt without exiting Python after

I run a script by entering "python filename.py" in Anaconda prompt. 我通过在Anaconda提示符下输入“ python filename.py”来运行脚本。 How do I run the file without exiting? 如何在不退出的情况下运行文件? (eg to introduce some function definitions, then use these definitions to do stuff in the prompt) (例如,引入一些函数定义,然后使用这些定义在提示中做一些事情)

Thanks in advance. 提前致谢。

use 采用

$ python -i filename.py

it does exactly what you want :) 它确实满足您的要求:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何防止以编程方式启动的python脚本在错误后退出命令提示符? - How to prevent programmatically started python script from exiting command prompt after error? 在继续运行脚本的同时从python脚本退出命令 - Exiting command from python script whilst continuing to run script 使用python脚本在命令提示符下运行命令 - Run commands in command prompt using python script 如何在没有命令提示符的情况下运行Python服 - How to run Python server without command prompt 如何在不退出python脚本的情况下销毁一个QApplication然后运行一个新的? - How to destroy a QApplication and then run a new one without exiting the python script? 退出命令行后如何在python中运行函数 - How to run function in python after exiting command line 如何打开命令提示符以及使用python脚本运行的命令? - How to open a command prompt along with a command to run using a python script? 重新启动脚本后命令提示符(Windows)和 python 脚本出现问题 - Issue with command prompt (windows) and python script after restarting script 在没有python命令的情况下在终端中运行python脚本 - run a python script in terminal without the python command 如何在命令提示符Windows 10中运行python脚本 - How to run python script in Command Prompt Windows 10
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM