Python 2.7 中 dash 的 pip 安装错误

pip Installation error for dash in Python 2.7

我希望在 Python 2.7.

上安装 Dash

我相信 Python 2.7 支持达世币 here

我运行下面的命令因为我有2个版本的python(2.7和3.8):

py -2 -m pip install dash==1.19.0

但是,我收到以下错误:

    ERROR: Command errored out with exit status 1:
     command: 'C:\Python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\setup.py'"'"'; __file__='"'"'c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'c:\users\windowsuser\appdata\local\temp\pip-record-dssb81\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Python27\Include\brotli'
         cwd: c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\
    Complete output (93 lines):
    running install
    running build
    running build_py
    creating bin
    creating bin\lib.win-amd64-2.7
    copying python\brotli.py -> bin\lib.win-amd64-2.7
    running build_ext
    building '_brotli' extension
    creating bin\temp.win-amd64-2.7
    creating bin\temp.win-amd64-2.7\Release
    creating bin\temp.win-amd64-2.7\Release\c
    creating bin\temp.win-amd64-2.7\Release\c\common
    creating bin\temp.win-amd64-2.7\Release\c\dec
    creating bin\temp.win-amd64-2.7\Release\c\enc
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/common/constants.c /Fobin\temp.win-amd64-2.7\Release\c/common/constants.obj
    constants.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/common/context.c /Fobin\temp.win-amd64-2.7\Release\c/common/context.obj
    context.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/common/dictionary.c /Fobin\temp.win-amd64-2.7\Release\c/common/dictionary.obj
    dictionary.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/common/platform.c /Fobin\temp.win-amd64-2.7\Release\c/common/platform.obj
    platform.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/common/transform.c /Fobin\temp.win-amd64-2.7\Release\c/common/transform.obj
    transform.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/dec/bit_reader.c /Fobin\temp.win-amd64-2.7\Release\c/dec/bit_reader.obj
    bit_reader.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/dec/decode.c /Fobin\temp.win-amd64-2.7\Release\c/dec/decode.obj
    decode.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/dec/huffman.c /Fobin\temp.win-amd64-2.7\Release\c/dec/huffman.obj
    huffman.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/dec/state.c /Fobin\temp.win-amd64-2.7\Release\c/dec/state.obj
    state.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/backward_references.c /Fobin\temp.win-amd64-2.7\Release\c/enc/backward_references.obj
    backward_references.c
    c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\c\enc\./find_match_length.h(34) : warning C4013: '_tzcnt_u64' undefined; assuming extern returning int
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/backward_references_hq.c /Fobin\temp.win-amd64-2.7\Release\c/enc/backward_references_hq.obj
    backward_references_hq.c
    c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\c\enc\./find_match_length.h(34) : warning C4013: '_tzcnt_u64' undefined; assuming extern returning int
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/bit_cost.c /Fobin\temp.win-amd64-2.7\Release\c/enc/bit_cost.obj
    bit_cost.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/block_splitter.c /Fobin\temp.win-amd64-2.7\Release\c/enc/block_splitter.obj
    block_splitter.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/brotli_bit_stream.c /Fobin\temp.win-amd64-2.7\Release\c/enc/brotli_bit_stream.obj
    brotli_bit_stream.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/cluster.c /Fobin\temp.win-amd64-2.7\Release\c/enc/cluster.obj
    cluster.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/command.c /Fobin\temp.win-amd64-2.7\Release\c/enc/command.obj
    command.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/compress_fragment.c /Fobin\temp.win-amd64-2.7\Release\c/enc/compress_fragment.obj
    compress_fragment.c
    c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\c\enc\./find_match_length.h(34) : warning C4013: '_tzcnt_u64' undefined; assuming extern returning int
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/compress_fragment_two_pass.c /Fobin\temp.win-amd64-2.7\Release\c/enc/compress_fragment_two_pass.obj
    compress_fragment_two_pass.c
    c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\c\enc\./find_match_length.h(34) : warning C4013: '_tzcnt_u64' undefined; assuming extern returning int
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/dictionary_hash.c /Fobin\temp.win-amd64-2.7\Release\c/enc/dictionary_hash.obj
    dictionary_hash.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/encode.c /Fobin\temp.win-amd64-2.7\Release\c/enc/encode.obj
    encode.c
    c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\c\enc\./find_match_length.h(34) : warning C4013: '_tzcnt_u64' undefined; assuming extern returning int
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/encoder_dict.c /Fobin\temp.win-amd64-2.7\Release\c/enc/encoder_dict.obj
    encoder_dict.c
    c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\c\enc\./find_match_length.h(34) : warning C4013: '_tzcnt_u64' undefined; assuming extern returning int
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/entropy_encode.c /Fobin\temp.win-amd64-2.7\Release\c/enc/entropy_encode.obj
    entropy_encode.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/fast_log.c /Fobin\temp.win-amd64-2.7\Release\c/enc/fast_log.obj
    fast_log.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/histogram.c /Fobin\temp.win-amd64-2.7\Release\c/enc/histogram.obj
    histogram.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/literal_cost.c /Fobin\temp.win-amd64-2.7\Release\c/enc/literal_cost.obj
    literal_cost.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/memory.c /Fobin\temp.win-amd64-2.7\Release\c/enc/memory.obj
    memory.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/metablock.c /Fobin\temp.win-amd64-2.7\Release\c/enc/metablock.obj
    metablock.c
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/static_dict.c /Fobin\temp.win-amd64-2.7\Release\c/enc/static_dict.obj
    static_dict.c
    c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\c\enc\./find_match_length.h(34) : warning C4013: '_tzcnt_u64' undefined; assuming extern returning int
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tcc/enc/utf8_util.c /Fobin\temp.win-amd64-2.7\Release\c/enc/utf8_util.obj
    utf8_util.c
    creating bin\temp.win-amd64-2.7\Release\python
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic/include -IC:\Python27\include -IC:\Python27\PC /Tppython/_brotli.cc /Fobin\temp.win-amd64-2.7\Release\python/_brotli.obj /EHsc
    _brotli.cc
    C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python.0\VC\Bin\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 /LIBPATH:C:\Python27\PC\VS9.0\amd64 /EXPORT:init_brotli bin\temp.win-amd64-2.7\Release\c/common/constants.obj bin\temp.win-amd64-2.7\Release\c/common/context.obj bin\temp.win-amd64-2.7\Release\c/common/dictionary.obj bin\temp.win-amd64-2.7\Release\c/common/platform.obj bin\temp.win-amd64-2.7\Release\c/common/transform.obj bin\temp.win-amd64-2.7\Release\c/dec/bit_reader.obj bin\temp.win-amd64-2.7\Release\c/dec/decode.obj bin\temp.win-amd64-2.7\Release\c/dec/huffman.obj bin\temp.win-amd64-2.7\Release\c/dec/state.obj bin\temp.win-amd64-2.7\Release\c/enc/backward_references.obj bin\temp.win-amd64-2.7\Release\c/enc/backward_references_hq.obj bin\temp.win-amd64-2.7\Release\c/enc/bit_cost.obj bin\temp.win-amd64-2.7\Release\c/enc/block_splitter.obj bin\temp.win-amd64-2.7\Release\c/enc/brotli_bit_stream.obj bin\temp.win-amd64-2.7\Release\c/enc/cluster.obj bin\temp.win-amd64-2.7\Release\c/enc/command.obj bin\temp.win-amd64-2.7\Release\c/enc/compress_fragment.obj bin\temp.win-amd64-2.7\Release\c/enc/compress_fragment_two_pass.obj bin\temp.win-amd64-2.7\Release\c/enc/dictionary_hash.obj bin\temp.win-amd64-2.7\Release\c/enc/encode.obj bin\temp.win-amd64-2.7\Release\c/enc/encoder_dict.obj bin\temp.win-amd64-2.7\Release\c/enc/entropy_encode.obj bin\temp.win-amd64-2.7\Release\c/enc/fast_log.obj bin\temp.win-amd64-2.7\Release\c/enc/histogram.obj bin\temp.win-amd64-2.7\Release\c/enc/literal_cost.obj bin\temp.win-amd64-2.7\Release\c/enc/memory.obj bin\temp.win-amd64-2.7\Release\c/enc/metablock.obj bin\temp.win-amd64-2.7\Release\c/enc/static_dict.obj bin\temp.win-amd64-2.7\Release\c/enc/utf8_util.obj bin\temp.win-amd64-2.7\Release\python/_brotli.obj /OUT:bin\lib.win-amd64-2.7\_brotli.pyd /IMPLIB:bin\temp.win-amd64-2.7\Release\c/common\_brotli.lib /MANIFESTFILE:bin\temp.win-amd64-2.7\Release\c/common\_brotli.pyd.manifest
    _brotli.obj : warning LNK4197: export 'init_brotli' specified multiple times; using first specification
       Creating library bin\temp.win-amd64-2.7\Release\c/common\_brotli.lib and object bin\temp.win-amd64-2.7\Release\c/common\_brotli.exp
    encode.obj : error LNK2001: unresolved external symbol _tzcnt_u64
    static_dict.obj : error LNK2001: unresolved external symbol _tzcnt_u64
    backward_references.obj : error LNK2019: unresolved external symbol _tzcnt_u64 referenced in function FindMatchLengthWithLimit
    backward_references_hq.obj : error LNK2001: unresolved external symbol _tzcnt_u64
    compress_fragment.obj : error LNK2001: unresolved external symbol _tzcnt_u64
    compress_fragment_two_pass.obj : error LNK2001: unresolved external symbol _tzcnt_u64
    bin\lib.win-amd64-2.7\_brotli.pyd : fatal error LNK1120: 1 unresolved externals
    error: command 'C:\Users\windowsuser\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe' failed with exit status 1120
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\setup.py'"'"'; __file__='"'"'c:\users\windowsuser\appdata\local\temp\pip-install-nfgoxk\brotli\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'c:\users\windowsuser\appdata\local\temp\pip-record-dssb81\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Python27\Include\brotli' Check the logs for full command output.

为什么会发生这种情况,有任何解决方案或想法吗?

*注意:在 Python 3.8 上安装 Dash 时没有错误 before/after 尝试在 Python 2.7.

上安装 Dash

安装brotli1.0.9时出现错误。对于 brotli,该问题也在他们的 github 上公开。它归结为 python 2 缺少 whl 文件,这导致 pip 尝试从源代码构建,但它失败了(可能是因为它不是那么简单)。

我刚刚在一个新鲜的环境中尝试过。您可以简单地安装旧版本的 brotli:

pip install brotli==1.0.7

然后安装dash