How to include and install local dependencies in setup.py in Python?

后端 未结 3 1169
隐瞒了意图╮
隐瞒了意图╮ 2020-12-06 16:54

I am creating a setup.py to distribute my application. This application has a number of dependencies which can be installed via pip, it also has some custom

3条回答
  •  不思量自难忘°
    2020-12-06 16:55

    Extending wiesiu_p's answer, you can install the dependency by linking to its source directory, which has its own setup.py.

    Assume you have the source files of your dependency my-dependency, and the root of my-dependency has its own setup.py. In your application's setup.py:

    setup(
      ...,
      install_requires=['other-dependency','my-dependency'],
      dependency_links=[
        # location to your my-dependency project directory
        ''.join(['file:\\', os.path.join(os.getcwd(), 'path', 'to', 'my-dependency#egg=my-dependency-1.0')])
      ]
    )
    

    Now if you run python setup.py install with your application's setup.py, it will install my-dependency.

提交回复
热议问题