在 PyCharm 中安装 python-networkmanager 失败

问题描述 投票:0回答:1

每当我尝试在 PyCharm 中安装 python-networkmanager 时,我都会收到以下错误: 我在 MacOS 上工作。已经尝试了很多解决方法,但没有任何效果。 当我尝试添加较低版本(例如 1.1)的模块时,它已安装。但是,这并不能解决问题,因为我仍然收到错误消息,即没有名为“networkmanager”的模块。

Collecting python-networkmanager
  Using cached python_networkmanager-2.2-py3-none-any.whl (12 kB)
Collecting dbus-python
  Using cached dbus-python-1.3.2.tar.gz (605 kB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'error'

  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [47 lines of output]
      Collecting meson-python>=0.8.1
        Using cached meson_python-0.12.1-py3-none-any.whl (66 kB)
      Collecting meson>=0.60.0
        Using cached meson-1.0.0-py3-none-any.whl (900 kB)
      Collecting ninja
        Using cached ninja-1.11.1-py2.py3-none-macosx_10_9_universal2.macosx_10_9_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl (270 kB)
      Collecting patchelf
        Using cached patchelf-0.17.2.0.tar.gz (167 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting setuptools
        Using cached setuptools-67.4.0-py3-none-any.whl (1.1 MB)
      Collecting wheel
        Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
      Collecting pyproject-metadata>=0.6.1
        Using cached pyproject_metadata-0.7.1-py3-none-any.whl (7.4 kB)
      Collecting packaging>=19.0
        Using cached packaging-23.0-py3-none-any.whl (42 kB)
      Building wheels for collected packages: patchelf
        Building wheel for patchelf (pyproject.toml): started
        Building wheel for patchelf (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Building wheel for patchelf (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [11 lines of output]
            Traceback (most recent call last):
              File "/private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-build-env-3d80gsc4/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 613, in setup
                cmkr = cmaker.CMaker(cmake_executable)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-build-env-3d80gsc4/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 146, in __init__
                self.cmake_version = get_cmake_version(self.cmake_executable)
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-build-env-3d80gsc4/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 101, in get_cmake_version
                raise SKBuildError(
      
            Problem with the CMake installation, aborting build. CMake executable is cmake
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for patchelf
      Failed to build patchelf
      ERROR: Could not build wheels for patchelf, which is required to install pyproject.toml-based projects
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

在安装 CMake 后安装 dbus-python 时出现同样的错误:

yaldara@YALDARA-M-M4ZL ~ %  PATH="/Applications/CMake.app/Contents/bin":"$PATH"
yaldara@YALDARA-M-M4ZL ~ % cmake
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>
  cmake [options] -S <path-to-source> -B <path-to-build>

Specify a source directory to (re-)generate a build system for it in the
current working directory.  Specify an existing build directory to
re-generate its build system.

Run 'cmake --help' for more information.

yaldara@YALDARA-M-M4ZL ~ % cmake --version
cmake version 3.25.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
yaldara@YALDARA-M-M4ZL ~ % pip install dbus-python
Collecting dbus-python
  Using cached dbus-python-1.3.2.tar.gz (605 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [163 lines of output]
      Collecting meson-python>=0.8.1
        Using cached meson_python-0.12.1-py3-none-any.whl (66 kB)
      Collecting meson>=0.60.0
        Using cached meson-1.0.0-py3-none-any.whl (900 kB)
      Collecting ninja
        Using cached ninja-1.11.1-py2.py3-none-macosx_10_9_universal2.macosx_10_9_x86_64.macosx_11_0_arm64.macosx_11_0_universal2.whl (270 kB)
      Collecting patchelf
        Using cached patchelf-0.17.2.0.tar.gz (167 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting setuptools
        Using cached setuptools-67.4.0-py3-none-any.whl (1.1 MB)
      Collecting wheel
        Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
      Collecting pyproject-metadata>=0.6.1
        Using cached pyproject_metadata-0.7.1-py3-none-any.whl (7.4 kB)
      Collecting packaging>=19.0
        Using cached packaging-23.0-py3-none-any.whl (42 kB)
      Building wheels for collected packages: patchelf
        Building wheel for patchelf (pyproject.toml): started
        Building wheel for patchelf (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Building wheel for patchelf (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [127 lines of output]
      
      
            --------------------------------------------------------------------------------
            -- Trying 'Ninja' generator
            --------------------------------
            ---------------------------
            ----------------------
            -----------------
            ------------
            -------
            --
            Not searching for unused variables given on the command line.
            CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
            -- Configuring incomplete, errors occurred!
            See also "/private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-install-6xyh9mxi/patchelf_7617823ac0224d0785b52af9641faa6d/_cmake_test_compile/build/CMakeFiles/CMakeOutput.log".
            --
            -------
            ------------
            -----------------
            ----------------------
            ---------------------------
            --------------------------------
            -- Trying 'Ninja' generator - failure
            --------------------------------------------------------------------------------
      
      
      
            --------------------------------------------------------------------------------
            -- Trying 'Unix Makefiles' generator
            --------------------------------
            ---------------------------
            ----------------------
            -----------------
            ------------
            -------
            --
            Not searching for unused variables given on the command line.
            -- The C compiler identification is AppleClang 14.0.0.14000029
            -- Detecting C compiler ABI info
            -- Detecting C compiler ABI info - done
            -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
            -- Detecting C compile features
            -- Detecting C compile features - done
            -- The CXX compiler identification is AppleClang 14.0.0.14000029
            -- Detecting CXX compiler ABI info
            -- Detecting CXX compiler ABI info - done
            -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
            -- Detecting CXX compile features
            -- Detecting CXX compile features - done
            -- Configuring done
            -- Generating done
            -- Build files have been written to: /private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-install-6xyh9mxi/patchelf_7617823ac0224d0785b52af9641faa6d/_cmake_test_compile/build
            --
            -------
            ------------
            -----------------
            ----------------------
            ---------------------------
            --------------------------------
            -- Trying 'Unix Makefiles' generator - success
            --------------------------------------------------------------------------------
      
            Configuring Project
              Working directory:
                /private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-install-6xyh9mxi/patchelf_7617823ac0224d0785b52af9641faa6d/_skbuild/macosx-13.0-x86_64-3.11/cmake-build
              Command:
                /Applications/CMake.app/Contents/bin/cmake /private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-install-6xyh9mxi/patchelf_7617823ac0224d0785b52af9641faa6d -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX:PATH=/private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-install-6xyh9mxi/patchelf_7617823ac0224d0785b52af9641faa6d/_skbuild/macosx-13.0-x86_64-3.11/cmake-install -DPYTHON_VERSION_STRING:STRING=3.11.2 -DSKBUILD:INTERNAL=TRUE -DCMAKE_MODULE_PATH:PATH=/private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-build-env-4xw577af/overlay/lib/python3.11/site-packages/skbuild/resources/cmake -DPYTHON_EXECUTABLE:PATH=/usr/local/Cellar/[email protected]/3.11.2/bin/python3.11 -DPYTHON_INCLUDE_DIR:PATH=/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/python3.11 -DPYTHON_LIBRARY:PATH=/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib -DPython_EXECUTABLE:PATH=/usr/local/Cellar/[email protected]/3.11.2/bin/python3.11 -DPython_ROOT_DIR:PATH=/usr/local/Cellar/[email protected]/3.11.2/Frameworks/Python.framework/Versions/3.11 -DPython_INCLUDE_DIR:PATH=/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/python3.11 -DPython_FIND_REGISTRY:STRING=NEVER -DPython3_EXECUTABLE:PATH=/usr/local/Cellar/[email protected]/3.11.2/bin/python3.11 -DPython3_ROOT_DIR:PATH=/usr/local/Cellar/[email protected]/3.11.2/Frameworks/Python.framework/Versions/3.11 -DPython3_INCLUDE_DIR:PATH=/usr/local/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/python3.11 -DPython3_FIND_REGISTRY:STRING=NEVER -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=13.0 -DCMAKE_OSX_ARCHITECTURES:STRING=x86_64
      
            -- The C compiler identification is AppleClang 14.0.0.14000029
            -- The CXX compiler identification is AppleClang 14.0.0.14000029
            -- Detecting C compiler ABI info
            -- Detecting C compiler ABI info - done
            -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
            -- Detecting C compile features
            -- Detecting C compile features - done
            -- Detecting CXX compiler ABI info
            -- Detecting CXX compiler ABI info - done
            -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
            -- Detecting CXX compile features
            -- Detecting CXX compile features - done
            -- Configuring done
            -- Generating done
            CMake Warning:
              Manually-specified variables were not used by the project:
      
                PYTHON_EXECUTABLE
                PYTHON_INCLUDE_DIR
                PYTHON_LIBRARY
                PYTHON_VERSION_STRING
                Python3_EXECUTABLE
                Python3_FIND_REGISTRY
                Python3_INCLUDE_DIR
                Python3_ROOT_DIR
                Python_EXECUTABLE
                Python_FIND_REGISTRY
                Python_INCLUDE_DIR
                Python_ROOT_DIR
                SKBUILD
      
      
            -- Build files have been written to: /private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-install-6xyh9mxi/patchelf_7617823ac0224d0785b52af9641faa6d/_skbuild/macosx-13.0-x86_64-3.11/cmake-build
            [ 11%] Creating directories for 'build_patchelf'
            [ 22%] No download step for 'build_patchelf'
            [ 33%] No update step for 'build_patchelf'
            [ 44%] Performing patch step for 'build_patchelf'
            ./bootstrap.sh: line 2: autoreconf: command not found
            make[2]: *** [build_patchelf-prefix/src/build_patchelf-stamp/build_patchelf-patch] Error 127
            make[1]: *** [CMakeFiles/build_patchelf.dir/all] Error 2
            make: *** [all] Error 2
            Traceback (most recent call last):
              File "/private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-build-env-4xw577af/overlay/lib/python3.11/site-packages/skbuild/setuptools_wrap.py", line 642, in setup
                cmkr.make(make_args, install_target=cmake_install_target, env=env)
              File "/private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-build-env-4xw577af/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 679, in make
                self.make_impl(clargs=clargs, config=config, source_dir=source_dir, install_target=install_target, env=env)
              File "/private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-build-env-4xw577af/overlay/lib/python3.11/site-packages/skbuild/cmaker.py", line 710, in make_impl
                raise SKBuildError(
      
            An error occurred while building with CMake.
              Command:
                /Applications/CMake.app/Contents/bin/cmake --build . --target install --config Release --
              Install target:
                install
              Source directory:
                /private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-install-6xyh9mxi/patchelf_7617823ac0224d0785b52af9641faa6d
              Working directory:
                /private/var/folders/p6/pp6v82wd47zf0t5s8xsqpccm0000gn/T/pip-install-6xyh9mxi/patchelf_7617823ac0224d0785b52af9641faa6d/_skbuild/macosx-13.0-x86_64-3.11/cmake-build
            Please check the install target is valid and see CMake's output for more information.
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for patchelf
      Failed to build patchelf
      ERROR: Could not build wheels for patchelf, which is required to install pyproject.toml-based projects
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.
yaldara@YALDARA-M-M4ZL ~ % 
python python-3.x python-2.7 pycharm networkmanager
1个回答
0
投票

一个解决方案可能是在您的 Mac 上单独安装 CMake,并确保它在您的系统路径中正确安装和配置。可以从官网下载最新的CMake版本:https://cmake.org/download/

安装CMake后,你可以尝试使用pip再次安装dbus-python:

pip install dbus-python

成功安装 dbus-python 后,您可以尝试安装 python-networkmanager:

pip install python-networkmanager

或者,您可以尝试使用一个命令将两个包一起安装:

pip install dbus-python python-networkmanager

如果问题依然存在,您可以尝试使用以下命令将 pip 和 setuptools 升级到最新版本:

pip install --upgrade pip
pip install --upgrade setuptools
© www.soinside.com 2019 - 2024. All rights reserved.