美文网首页
pip install xxx; OSError: could

pip install xxx; OSError: could

作者: Bllose | 来源:发表于2023-08-29 06:47 被阅读0次

    尝试安装包失败:

    python -m pip install playsound
    Collecting playsound
      Using cached playsound-1.3.0.tar.gz (7.7 kB)
      Installing build dependencies ... done
      Getting requirements to build wheel ... error
      error: subprocess-exited-with-error
    
      × Getting requirements to build wheel did not run successfully.
      │ exit code: 1
      ╰─> [23 lines of output]
          Traceback (most recent call last):
            File "C:\etc\Python\Python39\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
              main()
            File "C:\etc\Python\Python39\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
              json_out['return_val'] = hook(**hook_input['kwargs'])
            File "C:\etc\Python\Python39\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
              return hook(config_settings)
            File "C:\Users\***\AppData\Local\Temp\pip-build-env-52ac47u6\overlay\Lib\site-packages\setuptools\build_meta.py", line 355, in get_requires_for_build_wheel
              return self._get_build_requires(config_settings, requirements=['wheel'])
            File "C:\Users\***\AppData\Local\Temp\pip-build-env-52ac47u6\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in _get_build_requires
              self.run_setup()
            File "C:\Users\***\AppData\Local\Temp\pip-build-env-52ac47u6\overlay\Lib\site-packages\setuptools\build_meta.py", line 507, in run_setup
              super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
            File "C:\Users\***\AppData\Local\Temp\pip-build-env-52ac47u6\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in run_setup
              exec(code, locals())
            File "<string>", line 6, in <module>
            File "C:\etc\Python\Python39\lib\inspect.py", line 1024, in getsource
              lines, lnum = getsourcelines(object)
            File "C:\etc\Python\Python39\lib\inspect.py", line 1006, in getsourcelines
              lines, lnum = findsource(object)
            File "C:\etc\Python\Python39\lib\inspect.py", line 835, in findsource
              raise OSError('could not get source code')
          OSError: could not get source code
          [end of output]
    
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-error
    
    × Getting requirements to build wheel 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.
    

    关键信息: Getting requirements to build wheel did not run successfully

    解决方法

    pip install wheel setuptools pip --upgrade

    >pip install wheel setuptools pip --upgrade
    Collecting wheel
      Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/b8/8b/31273bf66016be6ad22bb7345c37ff350276cfd46e389a0c2ac5da9d9073/wheel-0.41.2-py3-none-any.whl.metadata
      Using cached wheel-0.41.2-py3-none-any.whl.metadata (2.2 kB)
    Requirement already satisfied: setuptools in c:\etc\python\python39\lib\site-packages (58.1.0)
    Collecting setuptools
      Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/4f/ab/0bcfebdfc3bfa8554b2b2c97a555569c4c1ebc74ea288741ea8326c51906/setuptools-68.1.2-py3-none-any.whl.metadata
      Using cached setuptools-68.1.2-py3-none-any.whl.metadata (6.2 kB)
    Requirement already satisfied: pip in c:\etc\python\python39\lib\site-packages (23.2.1)
    Using cached wheel-0.41.2-py3-none-any.whl (64 kB)
    Using cached setuptools-68.1.2-py3-none-any.whl (805 kB)
    Installing collected packages: wheel, setuptools
      Attempting uninstall: setuptools
        Found existing installation: setuptools 58.1.0
        Uninstalling setuptools-58.1.0:
          Successfully uninstalled setuptools-58.1.0
    Successfully installed setuptools-68.1.2 wheel-0.41.2
    
    python -m pip install playsound
    Collecting playsound
      Using cached playsound-1.3.0.tar.gz (7.7 kB)
      Preparing metadata (setup.py) ... done
    Building wheels for collected packages: playsound
      Building wheel for playsound (setup.py) ... done
      Created wheel for playsound: filename=playsound-1.3.0-py3-none-any.whl size=7043 sha256=baa89329ad3e88baa731fae79ac42ef8578727e9807c13ef903fad1e1a08f118
      Stored in directory: c:\users\***\appdata\local\pip\cache\wheels\ba\39\54\c8f7ff9a88a644d3c58b4dec802d90b79a2e0fb2a6b884bf82
    Successfully built playsound
    Installing collected packages: playsound
    Successfully installed playsound-1.3.0
    

    相关讨论

    #145
    AskUbuntu

    相关文章

      网友评论

          本文标题:pip install xxx; OSError: could

          本文链接:https://www.haomeiwen.com/subject/klenmdtx.html