无法从github安装python库 [英] Unable to install python library from github

查看:94
本文介绍了无法从github安装python库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的操作系统是OSX 10.10.5,并且我将Anaconda发行版用于python.我正在尝试从github安装以下库: https://github.com/gmum/pykernels

My OS is OSX 10.10.5 and I use Anaconda distribution for python. I am trying to install the following library from github: https://github.com/gmum/pykernels

当我尝试使用pip安装时:

When I try to use pip install:

pip install git+https://github.com/gmum/pykernels.git

我收到以下错误:

Collecting git+https://github.com/gmum/pykernels.git
  Cloning https://github.com/gmum/pykernels.git to /var/folders/dd/98c207155h57757dtxkyp44r0000gn/T/pip-x7zo1w22-build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Conda3/anaconda/lib/python3.5/tokenize.py", line 454, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/dd/98c207155h57757dtxkyp44r0000gn/T/pip-x7zo1w22-build/setup.py'  

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /var/folders/dd/98c207155h57757dtxkyp44r0000gn/T/pip-x7zo1w22-build/

Pip安装可用于其他库,我的setuptools也是最新的.

Pip install works well for other libraries and my setuptools is also up to date.

推荐答案

问题是,该库没有setup.py文件. pip执行/关注此文件.因此无法使用pip安装库.但是,您可以下载该库(存储库中的pykernels文件夹)并将其放置在当前文件夹中,或者将其路径添加到sys.path,如下所示:

The problem is, that library doesn't have a setup.py file. pip executes/follows this file. so that library cannot be installed using pip. You can, however, download and put that library (the pykernels folder inside the repo) in your current folder or add it's path to sys.path like this:

import sys
sys.path.append("Path to pykernels repo") 

请确保使用pip这样安装它们的依赖项:

Be sure to install their dependencies using pip like this:

pip install numpy scipy scikit-learn

然后,您只需在脚本中使用import pykernels.

Then you can just use import pykernels in your script.

编辑:setup.py现在已集成到存储库中,现在您可以使用pip:

Edit: setup.py is now integrated to the repository and now you can just use pip:

pip install git+https://github.com/gmum/pykernels.git

这篇关于无法从github安装python库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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