本文介绍了通过Jupyter笔记本从GitHub安装模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我第一次尝试从GitHub安装某些东西,但在这里和谷歌搜索后找不到一个简单的解决方案。 我使用Jupyter笔记本,试图安装此模块: 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:\ users \greatg〜1 \appdata\ local \temp\pip-1w_dpw43-build 错误[WinError 2]执行命令时系统找不到指定的文件git clone -q git://github.com/Expt-David/NumSchrodingerEq.git C : \\ Users \GREATG〜1 \AppData\Local\Temp\pip-1w_dpw43- build 找不到命令'git'您使用的是pip版本8.1.2,不过版本9.0。 1可用。 您应该考虑通过'python -m pip install --upgrade pip'命令进行升级。 编辑 收集git + https://github.com/Expt-David/NumSchrodingerEq.git 将https://github.com/Expt-David/NumSchrodingerEq.git克隆到c:\users\greatg〜1 \appdata\local\temp\pip -zpuki8tu-build 从命令python setup.py完成输出egg_info: Traceback(最近一次调用最后一次): File<字符串>,第1行,在< module> 打开 buffer = _builtin_open(filename,'rb') FileNotFoundError:[Errno 2]中的文件d:\\\\\\\\\\\\\\\\\\\'没有这样的文件或目录:'C:\\ Users \\GREATG〜1 \\AppData\\Local\\Temp\\pip-zpuki8tu-build\\setup .py' --------------------------------------- - 命令python setup.py egg_info失败,错误代码1在C:\ Users \GREATG〜1 \AppData\Local\Temp\pip-zpuki8tu-build\ 我已经安装并更新了setuptools。 我是否做错了? 谢谢!解决方案从PATH确实包含Git安装路径的会话中运行Jupyter Notebook。 和 c heck out pip issue 2109 : 在我的情况中,问题在于我在windows上的路径环境中定义了git路径。 PATH = ...; c:\python27\\scripts;c:\\ \\ Program Files \git\cmd; C:\ Tcl\bin; ... 当它追加 git.exe 文件名来检查它的存在时,它会保留符号并且检查失败。 这应该在最近版本的pip中修复,但是再次检查您的%PATH% 。 如果仍然失败,请尝试使用简化路径,并将Git安装在不带空格的简短PATH中: p> 使用最新Git for Windows (解压缩Git 2.13 PortableGit-2.13.2-64-bit.7z.exe 随时随地 C:\Git2.13.2 ) 设置一个简化的 PATH 。 关于 PATH 问题,请输入(在 set PATH = C:\ WINDOWS \ system32; C :\ WINDINDOWS; C:\WINDOWS\System32\Wbem; C:\WINDOWS\System32\WindowsPowerShell\v1.0\ set GH = C:\Git2.13.2 set PATH =%GH%\ bin;%GH%\usr\bin;%GH%\mingw64\bin;%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/NumSchrodingerEqi've tried to write this inside the notebook:!pip install git+git://github.com/Expt-David/NumSchrodingerEq.gitbut 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:\users\greatg~1\appdata\local\temp\pip-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:\Users\GREATG~1\AppData\Local\Temp\pip-1w_dpw43-buildCannot 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.EDITSeems 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:\users\greatg~1\appdata\local\temp\pip-zpuki8tu-build Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "d:\anaconda3\lib\tokenize.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:\Users\GREATG~1\AppData\Local\Temp\pip-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.PATH=...;c:\python27\scripts;"c:\Program Files\git\cmd";C:\Tcl\bin;...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:use the latest Git for Windows (uncompress Git 2.13 PortableGit-2.13.2-64-bit.7z.exe anywhere you want, for instance in C:\Git2.13.2)set a simplified PATH.Regarding the PATH issue, type (in a CMD):set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\set GH=C:\Git2.13.2set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%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笔记本从GitHub安装模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!