pip 설치 명령이 실패했습니다.

pip 설치 명령이 실패했습니다.

Q: 이 pip 설치 문제를 해결하는 방법은 무엇입니까?

일부 라이브러리를 설치하려고 합니다.

pip3 install pinecone-client openai tiktoken langchain

이런 일이 발생합니다:

$ pip3 install pinecone-client openai tiktoken langchain
Traceback (most recent call last):
  File "/usr/bin/pip3", line 11, in <module>
    load_entry_point('pip==20.0.2', 'console_scripts', 'pip3')()
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/main.py", line 73, in main
    command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/__init__.py", line 96, in create_command
    module = importlib.import_module(module_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 24, in <module>
    from pip._internal.cli.req_command import RequirementCommand
  File "/usr/lib/python3/dist-packages/pip/_internal/cli/req_command.py", line 15, in <module>
    from pip._internal.index.package_finder import PackageFinder
  File "/usr/lib/python3/dist-packages/pip/_internal/index/package_finder.py", line 21, in <module>
    from pip._internal.index.collector import parse_links
  File "/usr/lib/python3/dist-packages/pip/_internal/index/collector.py", line 12, in <module>
    from pip._vendor import html5lib, requests
ImportError: cannot import name 'html5lib' from 'pip._vendor' (/usr/lib/python3/dist-packages/pip/_vendor/__init__.py)

저는 Python을 처음 접했기 때문에 문제를 해결하는 가장 좋은 방법을 잘 모르겠습니다. 감사해요.

답변1

  • Python3.10 사용(기본값)

Ubuntu Jammy의 기본 Python 버전인 Python3.10으로 다시 전환합니다.Ubuntu에서 Python3 기본 버전 변경

  • Python3.11 사용

공식 저장소에서 Python3.11을 설치합니다.

jammy-updates universePython3.11은 저장소 에서 사용할 수 있습니다 . 다음 줄이 있어야 합니다 /etc/apt/sources.list.

deb http://de.archive.ubuntu.com/ubuntu/ jammy-updates main universe

타사 저장소(또는 컴파일된 저장소)에서 설치된 Python3.11을 제거한 후 다음을 수행합니다.

sudo apt remove python3.11
sudo apt update
sudo apt install python3.11

pipPython3.11이 제대로 작동하는지 확인하세요.

python3.11 -m pip install pinecone-client openai tiktoken langchain

관련 정보