【问题标题】:How to handle package installation errors?如何处理包安装错误?
【发布时间】:2022-02-05 06:54:26
【问题描述】:

我正在尝试在 python 中安装一个名为“sparsesvd”的包,但出现以下错误:

Collecting sparsesvd
      Using cached https://files.pythonhosted.org/packages/65/d9/c2545987871e27cad5969799a1d45073321a2904ac4dcb18bc0f1fe16ecc/sparsesvd-0.2.2.tar.gz
    Requirement already satisfied: scipy>=0.6.0 in c:\users\saurabh\appdata\local\programs\python\python37\lib\site-packages (from sparsesvd) (1.2.1)
    Requirement already satisfied: cython in c:\users\saurabh\appdata\local\programs\python\python37\lib\site-packages (from sparsesvd) (0.29.6)
    Requirement already satisfied: numpy>=1.8.2 in c:\users\saurabh\appdata\local\programs\python\python37\lib\site-packages (from scipy>=0.6.0->sparsesvd) (1.16.2)
    Installing collected packages: sparsesvd
      Running setup.py install for sparsesvd: started
        Running setup.py install for sparsesvd: finished with status 'error'
        Complete output from command C:\Users\Saurabh\AppData\Local\Programs\Python\Python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Saurabh\\AppData\\Local\\Temp\\pycharm-packaging\\sparsesvd\\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\Saurabh\AppData\Local\Temp\pip-record-wd31zika\install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_ext
        No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
        cythoning sparsesvd.pyx to sparsesvd.c
        C:\Users\Saurabh\AppData\Local\Programs\Python\Python37\lib\site-packages\Cython\Compiler\Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: C:\Users\Saurabh\AppData\Local\Temp\pycharm-packaging\sparsesvd\sparsesvd.pxd
          tree = Parsing.p_module(s, pxd, full_module_name)
        warning: sparsesvd.pxd:7:31: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
        warning: sparsesvd.pxd:7:40: Non-trivial type declarators in shared declaration (e.g. mix of pointers and values). Each pointer declaration should be on its own line.
        building 'sparsesvd' extension
        error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

        ----------------------------------------

    Command "C:\Users\IronMaiden\AppData\Local\Programs\Python\Python37\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Saurabh\\AppData\\Local\\Temp\\pycharm-packaging\\sparsesvd\\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\Saurabh\AppData\Local\Temp\pip-record-wd31zika\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Saurabh\AppData\Local\Temp\pycharm-packaging\sparsesvd\

【问题讨论】:

    标签: python package


    【解决方案1】:

    错误:需要 Microsoft Visual C++ 14.0。使用“Microsoft Visual C++ Build Tools”获取它:http://landinghub.visualstudio.com/visual-cpp-build-tools

    你安装了吗?

    编辑:原始链接无效。试试这个:https://visualstudio.microsoft.com/visual-cpp-build-tools/

    【讨论】:

    • 是的,我没有给出这个错误错误:命令“cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -IC:\Users\S\AppData\Local\Programs \Python\Python37\lib\site-packages\numpy\core\include -IC:\Users\S\AppData\Local\Programs\Python\Python37\include -IC:\Users\S\AppData\Local\Programs\Python \Python37\include /Tcsparsesvd.c /Fobuild\temp.win-amd64-3.7\Release\sparsesvd.obj" 失败,退出状态为 127
    • 我不确定我是否得到了您关于可视化 cpp 构建工具的答案。但是如果你安装了它,那么当你收到那个错误时,在安装包的过程中?这是完整的错误信息吗?
    • 是的,安装可视化 cpp 构建工具后出现错误
    • 我推荐使用Anaconda,因为它包含很多包。
    【解决方案2】:

    2022-我的问题通过安装最新版本的 MS Visual Stdio 得到了解决。不过,我没有任何充分的理由说明它为什么会起作用。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-11-02
    • 2020-03-24
    • 2020-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多