How to change a Python module name?

后端 未结 7 690
暗喜
暗喜 2021-01-02 23:56

Is it only possible if I rename the file? Or is there a __module__ variable to the file to define what\'s its name?

7条回答
  •  别那么骄傲
    2021-01-03 00:41

    I had an issue like this with bsddb. I was forced to install the bsddb3 module but hundreds of scripts imported bsddb. Instead of changing the import in all of them, I extracted the bsddb3 egg, and created a soft link in the site-packages directory so that both "bsddb" and "bsddb3" were one in the same to python.

提交回复
热议问题