Where should I put my own python module so that it can be imported

后端 未结 6 1821
心在旅途
心在旅途 2020-11-29 16:53

I have my own package in python and I am using it very often. what is the most elegant or conventional directory where i should put my package so it is going to be imported

6条回答
  •  囚心锁ツ
    2020-11-29 17:19

    If you're developing a module I would recommend to follow this.

    import sys
    sys.path.append("/home/mylinux/python-packages")
    

    Now any module you keep in python-packages is importable by Python-interpreter.

提交回复
热议问题