python - 如何修复 Python pip install openai 错误 : subprocess-exited-with-error

标签 python python-3.x windows openai-api gpt-3

我正在尝试使用 Python 3.11、Windows 操作系统安装 OpenAI,pip 已完全升级,但出现此错误。

这是完整的错误信息:

Collecting openai
  Using cached openai-0.26.0.tar.gz (54 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
  ╰─> [21 lines of output]
      Traceback (most recent call last):
        File "C:\Users\vocal\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
          main()
        File "C:\Users\vocal\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\vocal\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\vocal\AppData\Local\Temp\pip-build-env-lr3fjsgg\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\vocal\AppData\Local\Temp\pip-build-env-lr3fjsgg\overlay\Lib\site-packages\setuptools\build_meta.py", line 320, in _get_build_requires
          self.run_setup()
        File "C:\Users\vocal\AppData\Local\Temp\pip-build-env-lr3fjsgg\overlay\Lib\site-packages\setuptools\build_meta.py", line 485, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\vocal\AppData\Local\Temp\pip-build-env-lr3fjsgg\overlay\Lib\site-packages\setuptools\build_meta.py", line 335, in run_setup
          exec(code, locals())
        File "<string>", line 13, in <module>
      UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 1031: illegal multibyte sequence
      [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.

我不知道如何解决这个错误。谁能给我一个提示?

UnicodeDecodeError: 'cp949' codec can't decode byte 0xe2 in position 1031: illegal multibyte sequence

由于该消息,我尝试了 this解决方案,但没有用。

最佳答案

我最近在一个新的 Linux VM 上遇到了这个问题,但解决方案实际上非常简单。我将 pip 版本添加到安装命令中,例如pip3.10 install openai 一切正常。

对于您的 Windows 环境,这可能不是同一个问题,而是 here is the full write up I posted因为我当时找不到任何有用的信息。

关于python - 如何修复 Python pip install openai 错误 : subprocess-exited-with-error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75067851/

相关文章:

JAVA_HOME 指向无效的 Java 安装

windows - 在临时目录中创建文件时的“The process cannot access the file because it is being used by another process”

python - 简单的基本 Python 比较

python - 在 NaN 处的 Cumsum 重置

python - Numpy 数组减法

python - Python 3.3 是否比 2.7 更好地解码和重新编码已抓取的 Web 文本为 UTF-8?比如,好多了?

windows - 在 Windows TCP/IP 中以编程方式更改名称服务器

python - 如何在 Python 中按字符对字符串进行切片?

python-3.x - 包装io.BufferedIOBase,使其变为可搜索

Python 和 Nameko - GreenSSLSocket 没有公共(public)构造函数。实例由 SSLContext.wrap_socket() 返回。