繁体   English   中英

python pip包安装失败,'fix'后出现dllwrap错误:“找不到vcvarsall.bat”

[英]python pip package install fails , dllwrap error after 'fixing': “unable to find vcvarsall.bat”

我在档案中找不到这个。 mingw / msys有什么不对的吗? [我需要修复vcvarsall.bat,所以我可以安装其他软件包。]

无法使用pip.exe安装python包'twisted'。

我安装了python2.6和mingw / msys。 %PATH%包括C:\\MinGW\\C:\\MinGW\\mingw32\\bin

第一: pip.exe install twisted失败,说error: Unable to find 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

问题:为什么dllwrap会在pip中出现此错误?

_foo.exp: file not recognized: File format not recognized

简短的回答:检查你的PATH。 MinGW \\ bin需要接近它的开始。

答案很长:有一段时间我正在使用一种解决方法。 我从pip.log中获取了dllwrap命令并直接执行它。 这构建了.pyd并启用了pip install来完成工作。

我将--verbose标志传递给调用dllwrap的两种不同方式。 在pip下,这已经完成了。

dlltool: Opened temporary file: dumlc.s
dlltool: run: as   -o _bcrypt.exp dumlc.s
dlltool: Generated exports file

从命令行调用dllwrap给了这个。

C:\MinGW\bin\dlltool: Opened temporary file: demmc.s
C:\MinGW\bin\dlltool: run: C:\MinGW\bin\as   -o _bcrypt.exp demmc.s
C:\MinGW\bin\dlltool: Generated exports file

我的计算机运行Windows 7 64位但使用32位Python 2.7。 它是新的,但似乎预先安装了AMD APP SDK。 这有一个默认为64位输出的as.exe。

我的修复是编辑PATH,使C:\\ MinGW \\ bin超前于C:\\ Program Files(x86)\\ AMD APP \\ bin \\ x86_64

这个问题可以在Python代码中更加健壮地修复,尽管我还没有确定应该在virtualenv,pip或distutils中的位置。

使用MinGW构建扩展需要另外两件事,我将在此重复一下。

配置distutils以使用MinGW编译器

这可以在各种文件或命令行开关中完成。 我在我的主目录中选择了一个文件。

$ cat ~/pydistutils.cfg
[build]
compiler = mingw32

Patch distutils消除-mno-cygwin开关

作为管理员编辑Lib / distutils / cygwinccompiler.py。 删除四个-mno-cygwin选项。

s/ -mno-cygwin//

-mno-cygwin已经在gcc中弃用了一段时间,现在是一个错误。

http://bugs.python.org/issue12641

这可能是Python的一个错误。 http://bugs.python.org/issue2698

同时,您可以安装ActivePython并通过PyPM 安装Twisted (无需编译器)。

或者,您可以使用官方二进制文件 ...虽然我推荐上述解决方案,因为您可以在以后轻松“升级”到更新版本的Twisted。

在Windows上,我已安装Visual Studio 2008(vcsetup.exe)来解决此问题。

更新链接: http//www.microsoft.com/en-us/download/details.aspx?id = 15336

如果使用Python 3.3,则可以使用Visual Studio 2010

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM