来自GitHub存储库的Pip安装抛出错误 [英] Pip install from GitHub repo throws wheel error

查看:117
本文介绍了来自GitHub存储库的Pip安装抛出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我跑步时:

pip install git+ssh://git@github.mycompany.com/developer/sdk-python.git@master#egg=sdk-python

我看到以下输出:

Cloning ssh://git@github.mycompany.com/developer/sdk-python.git (to revision master) to /private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk-python
Generating metadata for package sdk-python produced metadata for project name sdk. Fix your #egg=sdk-python fragments.
Requirement already satisfied: requests in ./venv27/lib/python2.7/site-packages (from sdk) (2.21.0)
Requirement already satisfied: python-dateutil in ./venv27/lib/python2.7/site-packages (from sdk) (2.8.0)
Requirement already satisfied: certifi>=2017.4.17 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (2018.11.29)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (2.8)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in ./venv27/lib/python2.7/site-packages (from requests->sdk) (1.24.1)
Requirement already satisfied: six>=1.5 in ./venv27/lib/python2.7/site-packages (from python-dateutil->sdk) (1.12.0)
Building wheels for collected packages: sdk, sdk
  Building wheel for sdk (setup.py) ... done
  Stored in directory: /private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-ephem-wheel-cache-twLUBT/wheels/e5/b9/06/c754f4c2a0a2b191960dabcfc6f1dc7d0bb231e844cf4a032e
  Building wheel for sdk (setup.py) ... error
  Complete output from command /Users/me/git/sdk-python-test/venv27/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-wheel-OIQ_lk --python-tag cp27:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  IOError: [Errno 2] No such file or directory: '/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py'

  ----------------------------------------
  Failed building wheel for sdk
  Running setup.py clean for sdk
  Complete output from command /Users/me/git/sdk-python-test/venv27/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  IOError: [Errno 2] No such file or directory: '/private/var/folders/k1/h29nn0z959q0dr6b44kxx_8h0000gn/T/pip-install-txsz9E/sdk/setup.py'

  ----------------------------------------
  Failed cleaning build dir for sdk
Successfully built sdk
Failed to build sdk
Installing collected packages: sdk
Successfully installed sdk-1.0.0

在我看来,似乎已安装sdk-python.如果执行pip list,我什至可以看到它.但是,我不明白这些错误.其他类似的帖子建议缺少礼仪,但我看不到任何丢失的东西.

It looks to me as if sdk-python installed. I can even see it if I do pip list. However, I don't understand the errors. Other similar posts suggest missing depedencies but I ca't see anything that's missing.

有人可以告诉我怎么了吗

Can anybody tell me what's wrong?

下面是我的setup.py.我相信它是正确的,但这是我第一次创建一个,所以我主要基于我在网上找到的东西,因此可能不正确.如果有任何明显的错误,我很想听听那是什么.

Below is my setup.py. I believe it is correct but it's my first time creating one so I based it mstly on something I found online so it may not be correct. If there is anything obviously wrong with it I'd be keen to hear what that is.

#!/usr/bin/env python
import os
import re
import sys

from setuptools import setup, find_packages

# sdk python version check
_valid  =  sys.version_info[:2] == (2,7) or sys.version_info >= (3,4)
if not _valid:
    sys.exit("Sorry, SDK only supports versions 2.7, 3.4, 3.5, 3.6, 3.7 of python.")


ROOT = os.path.dirname(__file__)
VERSION_RE = re.compile(r'''__version__ = ['"]([a-z0-9._-]+)['"]''')

requirements = [
    'requests',
    'python-dateutil'
]


def get_version():
    init = open(os.path.join(ROOT, 'sdk', '__init__.py')).read()
    return VERSION_RE.search(init).group(1)


setup(
    name='sdk',
    version=get_version(),
    description='SDK for Python',
    long_description=open('README.md').read(),
    author='me',
    url='https://github.mycompany.com/developer/sdk-python',
    scripts=[],
    packages=find_packages(exclude=['tests*']),
    include_package_data=True,
    install_requires = requirements,
    license="Apache License 2.0",
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Intended Audience :: Developers',
        'Natural Language :: English',
        'License :: OSI Approved :: Apache Software License',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Programming Language :: Python :: 3.7',
    ],
)

其他信息

如果我运行它,它将安装没有问题:

It installs without issue if I run this:

pip install -e git+ssh://git@github.mycompany.com/developer/sdk-python.git@master#egg=sdk-python

我应该包含-e吗?我一直以为它是可选的,只有在我想编辑程序包时才会使用它.

Should I be including the -e? I always thought it was optional and only would have used it if I wanted to edit the package.

推荐答案

我的setup.py中的名字是sdk,但是我用来做鸡蛋的名字是sdk-python.据我所知,这些应该是相同的.

The name in my setup.py is sdk but the name I use for my egg is sdk-python. These should be the same from what I can tell.

我将命令更改为此,并且有效:

I changed my command to this and it worked:

pip install -e git+ssh://git@github.mycompany.com/developer/sdk-python.git@master#egg=sdk

这篇关于来自GitHub存储库的Pip安装抛出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆