在Windows中启动python时导入模块 [英] Import modules when starting python in Windows
本文介绍了在Windows中启动python时导入模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Windows上使用python.而且我正在尝试找到一种在启动python时导入一些默认模块的方法.这意味着,在启动python时,应该已经导入了某些模块,就像 buildins 一样.有什么办法吗?
I'm using python on Windows. And I'm trying to find a way to import some default module when starting python. It means, when starting python, some modules should be already imported, just like builtins. Is there any way?
谢谢.
推荐答案
如果您打算进入交互模式,只需编写一个小的启动脚本.而不是仅使用以下命令启动python:
If you mean while going into the interactive mode, just make a small startup script. Instead of just launching python with:
python
尝试:
python -i startupImports.py
startupImports.py:
startupImports.py:
import time
from collections import defaultdict
from customclass import myclass
#...etc
这篇关于在Windows中启动python时导入模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文