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

后端 未结 3 1932
粉色の甜心
粉色の甜心 2021-01-03 05:45

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 in

相关标签:
3条回答
  • 2021-01-03 06:21

    The question: why does dllwrap give this error within pip?

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

    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.

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

    Calling dllwrap from the command line gave this.

    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
    

    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.

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

    Patch distutils to eliminate the -mno-cygwin switch

    As admininistrator edit Lib/distutils/cygwinccompiler.py. Delete the four -mno-cygwin options.

    s/ -mno-cygwin//
    

    -mno-cygwin has been deprecated in gcc for a while and is now an error.

    See http://bugs.python.org/issue12641

    0 讨论(0)
  • 2021-01-03 06:26

    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.

    0 讨论(0)
  • 2021-01-03 06:30

    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

    0 讨论(0)
提交回复
热议问题