pip install a local git repository

后端 未结 3 1117
忘了有多久
忘了有多久 2021-01-30 02:59

I can\'t find the correct way to install a local directory as a python package using pip.

(venv) C:\\(...)>pip install . --no-index
Ignoring indexes: http://p         


        
相关标签:
3条回答
  • 2021-01-30 03:38

    You can use pip or pipenv with the following command to install from a local git repo:

    pip install git+file:///path/to/your/package#egg=package-name
    

    Note that there are 3 slashes after file: here.

    To install from a remote repo use:

    pip install git+ssh://git@github.com:Username/Project.git
    

    You can also specify a desired branch like so:

    pip install git+ssh://git@github.com:Username/Project.git@master
    

    I just rounded up the previous answers and comments from Quilt and nanounanue and this question. Also posted it here.

    0 讨论(0)
  • 2021-01-30 03:47

    If you're working in a venv, you can do this:

    env/bin/pip install git+file:///path/to/your/git/repo
    

    Or with a branch:

    env/bin/pip install git+file:///path/to/your/git/repo@mybranch
    
    0 讨论(0)
  • 2021-01-30 03:48

    I can also just use:

    cd your-local-repo
    pip install -e .
    

    or

    python setup.py install develop
    
    0 讨论(0)
提交回复
热议问题