我已经安装了 Microsoft Visual Studio,但仍然无法在 python 中安装 line_profiler。我该怎么办?

我已经安装了 Microsoft Visual Studio,但仍然无法在 python 中安装 line_profiler。我该怎么办?

命令当我尝试安装 line_profiler 时,显示了以下内容:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Windows\system32>pip install line_profiler
Collecting line_profiler
  Using cached line_profiler-3.1.0.tar.gz (45 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting IPython
  Using cached ipython-7.21.0-py3-none-any.whl (784 kB)
Collecting traitlets>=4.2
  Using cached traitlets-5.0.5-py3-none-any.whl (100 kB)
Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0
  Using cached prompt_toolkit-3.0.17-py3-none-any.whl (367 kB)
Collecting pickleshare
  Using cached pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Collecting decorator
  Using cached decorator-4.4.2-py2.py3-none-any.whl (9.2 kB)
Collecting backcall
  Using cached backcall-0.2.0-py2.py3-none-any.whl (11 kB)
Requirement already satisfied: colorama in c:\users\admin\appdata\local\programs
\python\python38\lib\site-packages (from IPython->line_profiler) (0.4.4)
Requirement already satisfied: setuptools>=18.5 in c:\users\admin\appdata\local\
programs\python\python38\lib\site-packages (from IPython->line_profiler) (47.1.0
)
Collecting pygments
  Using cached Pygments-2.8.1-py3-none-any.whl (983 kB)
Collecting jedi>=0.16
  Using cached jedi-0.18.0-py2.py3-none-any.whl (1.4 MB)
Collecting parso<0.9.0,>=0.8.0
  Using cached parso-0.8.1-py2.py3-none-any.whl (93 kB)
Collecting wcwidth
  Using cached wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Collecting ipython-genutils
  Using cached ipython_genutils-0.2.0-py2.py3-none-any.whl (26 kB)
Building wheels for collected packages: line-profiler
  Building wheel for line-profiler (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: 'c:\users\admin\appdata\local\programs\python\python38\python.exe' '
c:\users\admin\appdata\local\programs\python\python38\lib\site-packages\pip\_ven
dor\pep517\_in_process.py' build_wheel 'C:\Users\admin\AppData\Local\Temp\tmpuqn
nz8op'
       cwd: C:\Users\admin\AppData\Local\Temp\pip-install-o1wftv63\line-profiler
_9a20b79664db41e6915f260ef3413335
  Complete output (162 lines):
  Not searching for unused variables given on the command line.
  -- The C compiler identification is unknown
  CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
    No CMAKE_C_COMPILER could be found.

    Tell CMake where to find the compiler by setting either the environment
    variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
    the compiler, or to the compiler name if it is in the PATH.


  -- Configuring incomplete, errors occurred!
  See also "C:/Users/admin/AppData/Local/Temp/pip-install-o1wftv63/line-profiler
_9a20b79664db41e6915f260ef3413335/_cmake_test_compile/build/CMakeFiles/CMakeOutp
ut.log".
  See also "C:/Users/admin/AppData/Local/Temp/pip-install-o1wftv63/line-profiler
_9a20b79664db41e6915f260ef3413335/_cmake_test_compile/build/CMakeFiles/CMakeErro
r.log".
  Not searching for unused variables given on the command line.
  CMake Error at CMakeLists.txt:2 (PROJECT):
    Generator

      Visual Studio 15 2017 Win64

    could not find any instance of Visual Studio.



  -- Configuring incomplete, errors occurred!
  See also "C:/Users/admin/AppData/Local/Temp/pip-install-o1wftv63/line-profiler
_9a20b79664db41e6915f260ef3413335/_cmake_test_compile/build/CMakeFiles/CMakeOutp
ut.log".
  Not searching for unused variables given on the command line.
  -- The C compiler identification is unknown
  CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
    The CMAKE_C_COMPILER:

      cl

    is not a full path and was not found in the PATH.

    To use the NMake generator with Visual C++, cmake must be run from a shell
    that can use the compiler cl from the command line.  This environment is
    unable to invoke the cl compiler.  To fix this problem, run cmake from the
    Visual Studio Command Prompt (vcvarsall.bat).

    Tell CMake where to find the compiler by setting either the environment
    variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
    the compiler, or to the compiler name if it is in the PATH.


  -- Configuring incomplete, errors occurred!
  See also "C:/Users/admin/AppData/Local/Temp/pip-install-o1wftv63/line-profiler
_9a20b79664db41e6915f260ef3413335/_cmake_test_compile/build/CMakeFiles/CMakeOutp
ut.log".
  See also "C:/Users/admin/AppData/Local/Temp/pip-install-o1wftv63/line-profiler
_9a20b79664db41e6915f260ef3413335/_cmake_test_compile/build/CMakeFiles/CMakeErro
r.log".
  Not searching for unused variables given on the command line.
  -- The C compiler identification is unknown
  CMake Error at CMakeLists.txt:3 (ENABLE_LANGUAGE):
    The CMAKE_C_COMPILER:

      cl

    is not a full path and was not found in the PATH.

    To use the JOM generator with Visual C++, cmake must be run from a shell
    that can use the compiler cl from the command line.  This environment is
    unable to invoke the cl compiler.  To fix this problem, run cmake from the
    Visual Studio Command Prompt (vcvarsall.bat).

    Tell CMake where to find the compiler by setting either the environment
    variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
    the compiler, or to the compiler name if it is in the PATH.


  -- Configuring incomplete, errors occurred!
  See also "C:/Users/admin/AppData/Local/Temp/pip-install-o1wftv63/line-profiler
_9a20b79664db41e6915f260ef3413335/_cmake_test_compile/build/CMakeFiles/CMakeOutp
ut.log".
  See also "C:/Users/admin/AppData/Local/Temp/pip-install-o1wftv63/line-profiler
_9a20b79664db41e6915f260ef3413335/_cmake_test_compile/build/CMakeFiles/CMakeErro
r.log".


  ------------------------------------------------------------------------------
--
  -- Trying "Ninja (Visual Studio 15 2017 Win64 v141)" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Ninja (Visual Studio 15 2017 Win64 v141)" generator - failure
  ------------------------------------------------------------------------------
--



  ------------------------------------------------------------------------------
--
  -- Trying "Visual Studio 15 2017 Win64 v141" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "Visual Studio 15 2017 Win64 v141" generator - failure
  ------------------------------------------------------------------------------
--



  ------------------------------------------------------------------------------
--
  -- Trying "NMake Makefiles (Visual Studio 15 2017 Win64 v141)" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "NMake Makefiles (Visual Studio 15 2017 Win64 v141)" generator - fai
lure
  ------------------------------------------------------------------------------
--



  ------------------------------------------------------------------------------
--
  -- Trying "NMake Makefiles JOM (Visual Studio 15 2017 Win64 v141)" generator
  --------------------------------
  ---------------------------
  ----------------------
  -----------------
  ------------
  -------
  --
  --
  -------
  ------------
  -----------------
  ----------------------
  ---------------------------
  --------------------------------
  -- Trying "NMake Makefiles JOM (Visual Studio 15 2017 Win64 v141)" generator -
 failure
  ------------------------------------------------------------------------------
--

  ******************************************************************************
**
  scikit-build could not get a working generator for your system. Aborting build
.

  Building windows wheels for Python 3.8 requires Microsoft Visual Studio 2017.
  Get it with "Visual Studio 2017":

    https://visualstudio.microsoft.com/vs/

  ******************************************************************************
**
  ----------------------------------------
  ERROR: Failed building wheel for line-profiler
Failed to build line-profiler
ERROR: Could not build wheels for line-profiler which use PEP 517 and cannot be
installed directly

C:\Windows\system32>
New Text Document.txt
Displaying New Text Document.txt.

相关内容