Python: Referencing another project

后端 未结 5 580
悲&欢浪女
悲&欢浪女 2020-12-18 10:32

I want to be able to run my Python project from the command line. I am referencing other projects, so I need to be able run modules in other folders.

One method of

5条回答
  •  天涯浪人
    2020-12-18 10:46

    If you import sys, it contains a list of the directories in PYTHONPATH as sys.path

    Adding directories to this list (sys.path.append("my/path")) allows you to import from those locations in the current module as normal without changing the global settings on your system.

提交回复
热议问题