python pip 包安装失败,“修复”后出现 dllwrap 错误:“无法找到 vcvarsall.bat”
我在档案馆里找不到这个。 mingw/msys 有什么问题吗? [我需要修复 vcvarsall.bat,以便我可以安装其他软件包。]
无法使用 pip.exe 安装 python 软件包“twisted”。
我安装了 python2.6 和 mingw/msys 。 %PATH% 首先包含 C:\MinGW\
和 C:\MinGW\mingw32\bin
:pip.exe install twins
失败,并显示 <代码>错误:无法找到vcvarsall.bat 我创建文件 G:\Programs (x86)\Python 2.6\Lib\distutils\distutils.cfg
,其中包含:
[build]
compiler=mingw32
现在我得到的错误是:
g:\Programs (x86)\Python 2.6>python Scripts\pip-script.py install twisted
Downloading/unpacking twisted
Running setup.py egg_info for package twisted
Downloading/unpacking zope.interface (from twisted)
Running setup.py egg_info for package zope.interface
Requirement already satisfied (use --upgrade to upgrade): setuptools in g:\progr
ams (x86)\python 2.6\lib\site-packages (from zope.interface->twisted)
Installing collected packages: twisted, zope.interface
Running setup.py install for twisted
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ig:\Programs (x86)\Python
2.6\include" "-Ig:\Programs (x86)\Python 2.6\PC" -c conftest.c -o conftest.o
conftest.c:1:21: fatal error: rpc/rpc.h: No such file or directory
compilation terminated.
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ig:\Programs (x86)\Python
2.6\include" "-Ig:\Programs (x86)\Python 2.6\PC" -c conftest.c -o conftest.o
conftest.c:1:23: fatal error: sys/epoll.h: No such file or directory
compilation terminated.
building 'twisted.protocols._c_urlarg' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 "-Ig:\Programs (x8
6)\Python 2.6\include" "-Ig:\Programs (x86)\Python 2.6\PC" -c twisted/protocols/
_c_urlarg.c -o build\temp.win32-2.6\Release\twisted\protocols\_c_urlarg.o
twisted/protocols/_c_urlarg.c: In function 'unquote':
twisted/protocols/_c_urlarg.c:41:50: warning: 'tmp' may be used uninitialize
d in this function
C:\MinGW\bin\dllwrap.exe -mno-cygwin -mdll -static --output-lib build\temp.w
in32-2.6\Release\twisted\protocols\lib_c_urlarg.a --def build\temp.win32-2.6\Rel
ease\twisted\protocols\_c_urlarg.def -s build\temp.win32-2.6\Release\twisted\pro
tocols\_c_urlarg.o "-Lg:\Programs (x86)\Python 2.6\libs" "-Lg:\Programs (x86)\Py
thon 2.6\PCbuild" -lpython26 -lmsvcr90 -o build\lib.win32-2.6\twisted\protocols\
_c_urlarg.pyd
_c_urlarg.exp: file not recognized: File format not recognized
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
error: command 'dllwrap' failed with exit status 1
Complete output from command "g:\Programs (x86)\Python 2.6\python.exe" -c "i
mport setuptools;__file__='g:\\Programs (x86)\\Python 2.6\\build\\twisted\\setup
.py';execfile(__file__)" install --single-version-externally-managed --record c:
\users\jake\appdata\local\temp\pip-3y_c1e-record\install-record.txt:
running install
running build
running build_py
running egg_info
writing requirements to Twisted.egg-info\requires.txt
writing Twisted.egg-info\PKG-INFO
writing top-level names to Twisted.egg-info\top_level.txt
writing dependency_links to Twisted.egg-info\dependency_links.txt
reading manifest file 'Twisted.egg-info\SOURCES.txt'
writing manifest file 'Twisted.egg-info\SOURCES.txt'
running build_ext
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ig:\Programs (x86)\Python 2.6\
include" "-Ig:\Programs (x86)\Python 2.6\PC" -c conftest.c -o conftest.o
conftest.c:1:21: fatal error: rpc/rpc.h: No such file or directory
compilation terminated.
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ig:\Programs (x86)\Python 2.6\
include" "-Ig:\Programs (x86)\Python 2.6\PC" -c conftest.c -o conftest.o
conftest.c:1:23: fatal error: sys/epoll.h: No such file or directory
compilation terminated.
building 'twisted.protocols._c_urlarg' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 "-Ig:\Programs (x86)\P
ython 2.6\include" "-Ig:\Programs (x86)\Python 2.6\PC" -c twisted/protocols/_c_u
rlarg.c -o build\temp.win32-2.6\Release\twisted\protocols\_c_urlarg.o
twisted/protocols/_c_urlarg.c: In function 'unquote':
twisted/protocols/_c_urlarg.c:41:50: warning: 'tmp' may be used uninitialized in
this function
writing build\temp.win32-2.6\Release\twisted\protocols\_c_urlarg.def
C:\MinGW\bin\dllwrap.exe -mno-cygwin -mdll -static --output-lib build\temp.win32
-2.6\Release\twisted\protocols\lib_c_urlarg.a --def build\temp.win32-2.6\Release
\twisted\protocols\_c_urlarg.def -s build\temp.win32-2.6\Release\twisted\protoco
ls\_c_urlarg.o "-Lg:\Programs (x86)\Python 2.6\libs" "-Lg:\Programs (x86)\Python
2.6\PCbuild" -lpython26 -lmsvcr90 -o build\lib.win32-2.6\twisted\protocols\_c_u
rlarg.pyd
_c_urlarg.exp: file not recognized: File format not recognized
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
warning: manifest_maker: standard file '-c' not found
error: command 'dllwrap' failed with exit status 1
----------------------------------------
Command "g:\Programs (x86)\Python 2.6\python.exe" -c "import setuptools;__file__
='g:\\Programs (x86)\\Python 2.6\\build\\twisted\\setup.py';execfile(__file__)"
install --single-version-externally-managed --record c:\users\jake\appdata\local
\temp\pip-3y_c1e-record\install-record.txt failed with error code 1
Storing complete log in C:\Users\jake\AppData\Roaming\pip\pip.log
I can't find this in the archives. Is there something not right with mingw/msys?
[I need to get vcvarsall.bat fixed, so I can install other packages.]
Failure to install python package 'twisted' using pip.exe.
I have python2.6 and mingw/msys installed.
%PATH% includes C:\MinGW\
and C:\MinGW\mingw32\bin
first: pip.exe install twisted
fails by saying error: Unable to find vcvarsall.bat
I create file G:\Programs (x86)\Python 2.6\Lib\distutils\distutils.cfg
, which contains:
[build]
compiler=mingw32
Now the error I get is:
g:\Programs (x86)\Python 2.6>python Scripts\pip-script.py install twisted
Downloading/unpacking twisted
Running setup.py egg_info for package twisted
Downloading/unpacking zope.interface (from twisted)
Running setup.py egg_info for package zope.interface
Requirement already satisfied (use --upgrade to upgrade): setuptools in g:\progr
ams (x86)\python 2.6\lib\site-packages (from zope.interface->twisted)
Installing collected packages: twisted, zope.interface
Running setup.py install for twisted
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ig:\Programs (x86)\Python
2.6\include" "-Ig:\Programs (x86)\Python 2.6\PC" -c conftest.c -o conftest.o
conftest.c:1:21: fatal error: rpc/rpc.h: No such file or directory
compilation terminated.
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ig:\Programs (x86)\Python
2.6\include" "-Ig:\Programs (x86)\Python 2.6\PC" -c conftest.c -o conftest.o
conftest.c:1:23: fatal error: sys/epoll.h: No such file or directory
compilation terminated.
building 'twisted.protocols._c_urlarg' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 "-Ig:\Programs (x8
6)\Python 2.6\include" "-Ig:\Programs (x86)\Python 2.6\PC" -c twisted/protocols/
_c_urlarg.c -o build\temp.win32-2.6\Release\twisted\protocols\_c_urlarg.o
twisted/protocols/_c_urlarg.c: In function 'unquote':
twisted/protocols/_c_urlarg.c:41:50: warning: 'tmp' may be used uninitialize
d in this function
C:\MinGW\bin\dllwrap.exe -mno-cygwin -mdll -static --output-lib build\temp.w
in32-2.6\Release\twisted\protocols\lib_c_urlarg.a --def build\temp.win32-2.6\Rel
ease\twisted\protocols\_c_urlarg.def -s build\temp.win32-2.6\Release\twisted\pro
tocols\_c_urlarg.o "-Lg:\Programs (x86)\Python 2.6\libs" "-Lg:\Programs (x86)\Py
thon 2.6\PCbuild" -lpython26 -lmsvcr90 -o build\lib.win32-2.6\twisted\protocols\
_c_urlarg.pyd
_c_urlarg.exp: file not recognized: File format not recognized
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
error: command 'dllwrap' failed with exit status 1
Complete output from command "g:\Programs (x86)\Python 2.6\python.exe" -c "i
mport setuptools;__file__='g:\\Programs (x86)\\Python 2.6\\build\\twisted\\setup
.py';execfile(__file__)" install --single-version-externally-managed --record c:
\users\jake\appdata\local\temp\pip-3y_c1e-record\install-record.txt:
running install
running build
running build_py
running egg_info
writing requirements to Twisted.egg-info\requires.txt
writing Twisted.egg-info\PKG-INFO
writing top-level names to Twisted.egg-info\top_level.txt
writing dependency_links to Twisted.egg-info\dependency_links.txt
reading manifest file 'Twisted.egg-info\SOURCES.txt'
writing manifest file 'Twisted.egg-info\SOURCES.txt'
running build_ext
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ig:\Programs (x86)\Python 2.6\
include" "-Ig:\Programs (x86)\Python 2.6\PC" -c conftest.c -o conftest.o
conftest.c:1:21: fatal error: rpc/rpc.h: No such file or directory
compilation terminated.
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ig:\Programs (x86)\Python 2.6\
include" "-Ig:\Programs (x86)\Python 2.6\PC" -c conftest.c -o conftest.o
conftest.c:1:23: fatal error: sys/epoll.h: No such file or directory
compilation terminated.
building 'twisted.protocols._c_urlarg' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DWIN32=1 "-Ig:\Programs (x86)\P
ython 2.6\include" "-Ig:\Programs (x86)\Python 2.6\PC" -c twisted/protocols/_c_u
rlarg.c -o build\temp.win32-2.6\Release\twisted\protocols\_c_urlarg.o
twisted/protocols/_c_urlarg.c: In function 'unquote':
twisted/protocols/_c_urlarg.c:41:50: warning: 'tmp' may be used uninitialized in
this function
writing build\temp.win32-2.6\Release\twisted\protocols\_c_urlarg.def
C:\MinGW\bin\dllwrap.exe -mno-cygwin -mdll -static --output-lib build\temp.win32
-2.6\Release\twisted\protocols\lib_c_urlarg.a --def build\temp.win32-2.6\Release
\twisted\protocols\_c_urlarg.def -s build\temp.win32-2.6\Release\twisted\protoco
ls\_c_urlarg.o "-Lg:\Programs (x86)\Python 2.6\libs" "-Lg:\Programs (x86)\Python
2.6\PCbuild" -lpython26 -lmsvcr90 -o build\lib.win32-2.6\twisted\protocols\_c_u
rlarg.pyd
_c_urlarg.exp: file not recognized: File format not recognized
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
warning: manifest_maker: standard file '-c' not found
error: command 'dllwrap' failed with exit status 1
----------------------------------------
Command "g:\Programs (x86)\Python 2.6\python.exe" -c "import setuptools;__file__
='g:\\Programs (x86)\\Python 2.6\\build\\twisted\\setup.py';execfile(__file__)"
install --single-version-externally-managed --record c:\users\jake\appdata\local
\temp\pip-3y_c1e-record\install-record.txt failed with error code 1
Storing complete log in C:\Users\jake\AppData\Roaming\pip\pip.log
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可能是 Python 的一个错误。请参阅 http://bugs.python.org/issue2698
同时,您可以安装 ActivePython 和 安装通过 PyPM Twisted(无需编译器)。
或者,您可以使用
This is likely a bug with Python. See http://bugs.python.org/issue2698
Meanwhile, you could install ActivePython and install Twisted via PyPM (no compilers needed).
Alternatively, you can use the official binary ... though I recommend the aforementioned solution as you can easily 'upgrade' to newer versions of Twisted in future.
问题:为什么 dllwrap 在 pip 中给出这个错误?
简短的回答:检查你的路径。 MinGW\bin 需要位于其开头附近。
长答案:有一段时间我正在使用一种解决方法。我从pip.log中抓取了dllwrap命令并直接执行。这构建了 .pyd 并启用 pip install 来完成工作。
我将 --verbose 标志传递给这两种不同的调用 dllwrap 的方式。在 pip 下,这件事正在完成。
从命令行调用 dllwrap 给出了这个。
我的计算机运行的是 Windows 7 64 位,但运行的是 32 位 Python 2.7。它是新的,但似乎预装了 AMD APP SDK。其中有一个 as.exe,默认为 64 位输出。
我的修复方法是编辑 PATH,使 C:\MinGW\bin 位于 C:\Program Files (x86)\AMD APP\bin\x86_64 之前
这个问题可以在 Python 代码中得到更可靠的修复,尽管我还没有确定应该在 virtualenv、pip 或 distutils 中的哪个位置完成。
使用 MinGW 构建扩展还需要另外两件事,我将在这里简要重复一下。
配置 distutils 以使用 MinGW 编译器
这可以在各种文件或命令行开关中完成。我选择了我的主目录中的一个文件。
修补 distutils 以消除 -mno-cygwin 开关
作为管理员编辑 Lib/distutils/cygwinccompiler.py。删除四个 -mno-cygwin 选项。
-mno-cygwin 在 gcc 中已被弃用一段时间,现在是一个错误。
请参阅http://bugs.python.org/issue12641
The question: why does dllwrap give this error within pip?
Short answer: check your PATH. MinGW\bin needs to be near the start of it.
Long answer: For a while I was using a work around. I grabbed the dllwrap command from the pip.log and executed it directly. That built the .pyd and enabled pip install to finish off the job.
I passed the --verbose flag into these two different ways of calling dllwrap. Under pip this was being done.
Calling dllwrap from the command line gave this.
My computer is running Windows 7 64-bit but with 32-bit Python 2.7. It is new but seems to have the AMD APP SDK pre-installed. That has an as.exe which defaults to 64-bit output.
My fix was to edit the PATH so that C:\MinGW\bin is ahead of C:\Program Files (x86)\AMD APP\bin\x86_64
This problem could be fixed more robustly in the Python code though I have not pinned down where in virtualenv, pip or distutils that should be done.
There are two other things needed to build extensions using MinGW which I'll repeat here briefly.
Configure distutils to use the MinGW compiler
This can be done in a variety of files or command line switches. I opted for a file in my home directory.
Patch distutils to eliminate the -mno-cygwin switch
As admininistrator edit Lib/distutils/cygwinccompiler.py. Delete the four -mno-cygwin options.
-mno-cygwin has been deprecated in gcc for a while and is now an error.
See http://bugs.python.org/issue12641
在 Windows 上,我安装了 Visual Studio 2008 (vcsetup.exe) 来解决这个问题。
更新的链接:
http://www.microsoft.com/en-us/download /details.aspx?id=15336
如果使用 Python 3.3,您可以使用 Visual Studio 2010
On Windows, I have installed Visual Studio 2008 (vcsetup.exe) to go around this problem.
updated link:
http://www.microsoft.com/en-us/download/details.aspx?id=15336
If using Python 3.3 you can use Visual Studio 2010