通过 Jupyter notebook 从 GitHub 安装模块 [英] Installing module from GitHub through Jupyter notebook

查看:107
本文介绍了通过 Jupyter notebook 从 GitHub 安装模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次尝试从 GitHub 安装一些东西,但在此处和谷歌上搜索后找不到简单的解决方案.

我正在使用 Jupyter notebook 并尝试安装此模块:

https://github.com/Expt-David/NumSchrodingerEq

我试着把这个写在笔记本里:

!pip install git+git://github.com/Expt-David/NumSchrodingerEq.git

但我收到以下错误:

收集git+git://github.com/Expt-David/NumSchrodingerEq.git将 git://github.com/Expt-David/NumSchrodingerEq.git 克隆到 c:usersgreatg~1appdatalocal	emppip-1w_dpw43-build错误 [WinError 2] 执行命令时系统找不到指定的文件 git clone -q git://github.com/Expt-David/NumSchrodingerEq.git C:UsersGREATG~1AppDataLocalTemppip-1w_dpw43-build找不到命令git"您使用的是 pip 版本 8.1.2,但是版本 9.0.1 可用.您应该考虑通过python -m pip install --upgrade pip"命令进行升级.

编辑

似乎再次安装 git 并手动删除路径并编辑自己可以解决该问题,但现在我得到了:

收集git+https://github.com/Expt-David/NumSchrodingerEq.git克隆 https://github.com/Expt-David/NumSchrodingerEq.git 到 c:usersgreatg~1appdatalocal	emppip-zpuki8tu-build命令 python setup.py egg_info 的完整输出:回溯(最近一次调用最后一次):文件<string>",第 1 行,在 <module> 中文件d:anaconda3lib	okenize.py",第 454 行,打开缓冲区 = _builtin_open(文件名,'rb')FileNotFoundError: [Errno 2] 没有这样的文件或目录:'C:\Users\GREATG~1\AppData\Local\Temp\pip-zpuki8tu-build\setup.py'----------------------------------------命令python setup.py egg_info"在 C:UsersGREATG~1AppDataLocalTemppip-zpuki8tu-build 中失败,错误代码为 1

我已经安装并更新了 setuptools.

我做错了什么?

谢谢!

解决方案

确保从 PATH 包含 Git 安装路径的会话中运行 Jupyter Notebook.

查看 pip 问题 2109:

就我而言,问题是我在 Windows 的路径环境中定义了 git 路径的方式.

<块引用>

pip.util 中声明的函数 find_command 在带引号的句柄路径中失败,例如:

PATH=...;c:python27scripts;"c:Program Filesgitcmd";C:Tclin;...

<块引用>

当它附加 git.exe 文件名以检查其是否存在时,它会保留 " 符号并且检查失败.

这应该在最新版本的 pip 中得到修复,但再次仔细检查您的 %PATH%.

<小时>

如果仍然失败,请尝试使用简化的路径,并将 Git 安装在没有空格的短路径中:

关于 PATH 问题,输入(在 CMD 中):

set PATH=C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0设置 GH=C:Git2.13.2设置 PATH=%GH%in;%GH%usrin;%GH%mingw64in;%PATH%

PATH 添加你需要的 python/pip.
然后再试一次.

<小时>

对于您的第二条错误消息,请考虑pip 安装错误没有这样的文件或目录:setup.py"",并仔细检查您的 Python 版本:pip 适用于 python 2.pip3 适用于 python 3.

My first time trying to install something from GitHub, but couldn't find a simple solution after searching here and on google.

I'm using Jupyter notebook and trying to install this module:

https://github.com/Expt-David/NumSchrodingerEq

i've tried to write this inside the notebook:

!pip install git+git://github.com/Expt-David/NumSchrodingerEq.git

but i'm getting the following error:

Collecting git+git://github.com/Expt-David/NumSchrodingerEq.git
  Cloning git://github.com/Expt-David/NumSchrodingerEq.git to c:usersgreatg~1appdatalocal	emppip-1w_dpw43-build
  Error [WinError 2] The system cannot find the file specified while executing command git clone -q git://github.com/Expt-David/NumSchrodingerEq.git C:UsersGREATG~1AppDataLocalTemppip-1w_dpw43-build
Cannot find command 'git'
You are using pip version 8.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

EDIT

Seems that installing git again and manually delete the path and edit myself worked for that issue, but now i'm getting:

Collecting git+https://github.com/Expt-David/NumSchrodingerEq.git
  Cloning https://github.com/Expt-David/NumSchrodingerEq.git to c:usersgreatg~1appdatalocal	emppip-zpuki8tu-build
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "d:anaconda3lib	okenize.py", line 454, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\GREATG~1\AppData\Local\Temp\pip-zpuki8tu-build\setup.py'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:UsersGREATG~1AppDataLocalTemppip-zpuki8tu-build

And I have setuptools installed and updated.

What am I doing wrong ?

Thanks!

解决方案

Make sure you run your Jupyter Notebook from a session where PATH does include the path to your Git installation.

And check out pip issue 2109:

In my case the problem was the way I had the path to git defined in my path environment on windows.

the function find_command declared in pip.util fails in handle paths with quote, like:

PATH=...;c:python27scripts;"c:Program Filesgitcmd";C:Tclin;...

when it appends the git.exe filename to check its existence it keeps the " symbol and the check fails.

That should be fixed in recent version of pip, but again, double-check your %PATH%.


If that still fails, try with a simplified path, and Git installed in a short PATH without space:

Regarding the PATH issue, type (in a CMD):

set PATH=C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0
set GH=C:Git2.13.2
set PATH=%GH%in;%GH%usrin;%GH%mingw64in;%PATH%

Add to that PATH what you need for python/pip.
Then try again.


For your second error message, consider "pip installation error "No such file or directory: setup.py"", and double-check your version of Python: pip is for python 2. pip3 is for python 3.

这篇关于通过 Jupyter notebook 从 GitHub 安装模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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