Speeding up the python “import” loader

后端 未结 5 1397
逝去的感伤
逝去的感伤 2020-12-14 17:49

I\'m getting seriously frustrated at how slow python startup is. Just importing more or less basic modules takes a second, since python runs down the sys.path looking for m

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-14 18:18

    The first things that come to mind are:

    • Try a smaller path
    • Make sure your modules are pyc's so they'll load faster
    • Make sure you don't double import, or import too much

    Other than that, are you sure that the disk operations are what's bogging you down? Is your disk/operating system really busy or old and slow?

    Maybe a defrag is in order?

提交回复
热议问题