这里有新手:如何在Windows 7中将补丁应用于python包的源代码?

时间:2017-02-06 01:56:02

标签: windows patch pygraphviz

我正在尝试在Windows 7 x64下为Python 3.5 x86安装Pygraphviz 尝试安装后,我收到此处显示的错误

https://github.com/Kagami/pygraphviz/commit/fe442dc16accb629c3feaf157af75f67ccabbd6e

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo
 /INCREMENTAL:NO "/LIBPATH:C:\Program Files (x86)\Graphviz2.38\lib\debug\lib" /L
IBPATH:C:\winpy\python-3.4.3\libs /LIBPATH:C:\winpy\python-3.4.3\PCbuild cgraph.
lib cdt.lib /EXPORT:PyInit__graphviz build\temp.win32-3.4\Release\pygraphviz/gra
phviz_wrap.obj /OUT:build\lib.win32-3.4\pygraphviz\_graphviz.pyd /IMPLIB:build\t
emp.win32-3.4\Release\pygraphviz\_graphviz.lib /MANIFESTFILE:build\temp.win32-3.
4\Release\pygraphviz\_graphviz.pyd.manifest
   Creating library build\temp.win32-3.4\Release\pygraphviz\_graphviz.lib and ob
ject build\temp.win32-3.4\Release\pygraphviz\_graphviz.exp
graphviz_wrap.obj : error LNK2019: unresolved external symbol _PyIOBase_Type ref
erenced in function __wrap_agread
build\lib.win32-3.4\pygraphviz\_graphviz.pyd : fatal error LNK1120: 1 unresolved
 externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\
link.exe' failed with exit status 1120

在该线程的底部有一个对必须应用于pygraphviz包的补丁的引用,然后我想我将不得不从源代码安装它

我的问题是:如何在Windows中使用补丁?

更新:我已经下载了Windows补丁和补丁文件 我把它们放在与源包相同的文件夹中 - 见图片

enter image description here

现在我需要为此找到正确的命令行开关 干运行(补丁--Dry-run< fixpygraphviz.patch )给我这个错误

can't find file to patch at input line 16
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|From fe442dc16accb629c3feaf157af75f67ccabbd6e Mon Sep 17 00:00:00 2001
|From: Kagami Hiiragi <kagami@genshiken.org>
|Date: Mon, 4 Aug 2014 21:57:54 +0400
|Subject: [PATCH] Workaround for PyIOBase_Type for Python3 on win
|
|Fixes #16
|---
| pygraphviz/graphviz.i      | 23 +++++++++++++++++++++--
| pygraphviz/graphviz_wrap.c | 24 +++++++++++++++++++++---
| 2 files changed, 42 insertions(+), 5 deletions(-)
|
|diff --git a/pygraphviz/graphviz.i b/pygraphviz/graphviz.i
|index 8c06805..55e5b6d 100644
|--- a/pygraphviz/graphviz.i
|+++ b/pygraphviz/graphviz.i
--------------------------
File to patch:

1 个答案:

答案 0 :(得分:0)

patch -px -i patchfilename

其中x表示要从补丁文件中指示的路径跳过多少级别的文件夹。在我的情况下,它是p1,这意味着补丁应该寻找“文件夹/文件名”,而不是补丁文件中指示的“文件夹/文件夹/文件名”。