简体   繁体   English

编辑python脚本而无需重新加载库

[英]Edit python script without reloading libraries

I am working on a project that involves some huge libraries. 我正在从事一个涉及一些大型图书馆的项目。 Every time I want to make minor changes to my script, I have to reload all the dependencies, which takes a very long time. 每次我想对脚本进行小的更改时,都必须重新加载所有依赖项,这需要很长时间。 Is there a way to make edits and reload without reloading all the dependencies? 有没有一种方法可以进行编辑和重新加载而不重新加载所有依赖项?

Possibly related, but doesn't fully answer my question: Auto-run a python script without reloading dependencies 可能相关,但不能完全回答我的问题: 自动运行python脚本而无需重新加载依赖项

I found the answer myself. 我自己找到了答案。 For other searching: 对于其他搜索:

suppose I make a script called HurrDurr 假设我编写了一个名为HurrDurr的脚本

HurrDurr = reload(HurrDurr) will reload just that script. HurrDurr = reload(HurrDurr)将只重新加载该脚本。 So move the big dependencies to another file and make your minor changes by reloading. 因此,将大的依赖项移至另一个文件,然后通过重新加载进行小的更改。

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

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