gpt4 book ai didi

python - 通过 Jupyter notebook 从 GitHub 安装模块

转载 作者:行者123 更新时间:2023-12-05 05:20:10 26 4
gpt4 key购买 nike

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

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

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

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

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

但我收到以下错误:

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-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.

编辑

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

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\

我安装并更新了 setuptools。

我做错了什么?

谢谢!

最佳答案

确保从 PATH 包含 Git 安装路径的 session 中运行 Jupyter Notebook。

check out pip issue 2109 :

在我的例子中,问题是我在 Windows 的路径环境中定义了 git 的路径。

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

PATH=...;c:\python27\scripts;"c:\Program Files\git\cmd";C:\Tcl\bin;...

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

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


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

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

set PATH=C:\WINDOWS\system32;C:\WINDOWS;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%

将 python/pip 所需的内容添加到 PATH
然后重试。


对于第二条错误消息,请考虑“pip installation error “No such file or directory: setup.py”,并仔细检查您的 Python 版本:pip 适用于 python 2。pip3 适用于 python 3 .

关于python - 通过 Jupyter notebook 从 GitHub 安装模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44873473/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com