简体   繁体   English

从 github repo 安装 pip 不起作用

[英]pip install from github repo doesn't work

I want to use a github repository that contains json schemas in my testing project.我想在我的测试项目中使用包含 json 模式的 github 存储库。

I am trying to install it with: pip install git+https://github.com/org/repo.git我正在尝试安装它: pip install git+https://github.com/org/repo.git

Collecting git+https://github.com/org/repo.git
  Cloning https://github.com/org/repo.git to /var/folders/7v/yqj59phx3q71thk7b9819nlm0000gn/T/pip-6UQL0O-build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    IOError: [Errno 2] No such file or directory: '/var/folders/7v/yqj59phx3q71thk7b9819nlm0000gn/T/pip-6UQL0O-build/setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /var/folders/7v/yqj59phx3q71thk7b9819nlm0000gn/T/pip-6UQL0O-build/

First question: Why is it cloning into this folder instead of /Users/raitis/.virtualenvs/someenvironment/bin/python ?第一个问题:为什么要克隆到这个文件夹而不是/Users/raitis/.virtualenvs/someenvironment/bin/python

Second question: Do I need to have setup.py file in a repository if I want to install it with pip?第二个问题:如果我想用 pip 安装它,我是否需要在存储库中有 setup.py 文件?

Note: After I can install it with pip I will add it to requirements.txt注意:在我可以用 pip 安装后,我会将它添加到 requirements.txt

Yes, you need a setup.py to install your lib.是的,你需要一个 setup.py 来安装你的库。

Pip first clones your repo and then tries a python setup.py install in your virtual environment. Pip 首先克隆您的存储库,然后在您的虚拟环境中尝试python setup.py install

This is exactly the same as when you install from tar.gz: first, you download it (equivalent of the git clone), then install it (python setup.py)这与从 tar.gz 安装时完全相同:首先,下载它(相当于 git clone),然后安装它(python setup.py)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM