无法安装sentpiece如何解决

问题描述 投票:0回答:1
(venve) C:\model>pip install sentencepiece
Collecting sentencepiece
  Using cached sentencepiece-0.1.99.tar.gz (2.6 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\ibrahim\AppData\Local\Temp\pip-install-v9em858u\sentencepiece_ca5fa4f5e3e14f8fa3ba35c617f010d9\setup.py", line 126, in <module>
          subprocess.check_call([
        File "C:\Program Files\Python312\Lib\subprocess.py", line 408, in check_call
          retcode = call(*popenargs, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Program Files\Python312\Lib\subprocess.py", line 389, in call
          with Popen(*popenargs, **kwargs) as p:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Program Files\Python312\Lib\subprocess.py", line 1026, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "C:\Program Files\Python312\Lib\subprocess.py", line 1538, in _execute_child
          hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      FileNotFoundError: [WinError 2] The system cannot find the file specified
      [end of output]

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

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

(venve) C:\model>python model.py
Traceback (most recent call last):
  File "C:\model\model.py", line 7, in <module>
    tokenizer = T5Tokenizer.from_pretrained(model_name)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\model\venve\Lib\site-packages\transformers\utils\import_utils.py", line 1304, in __getattribute__
    requires_backends(cls, cls._backends)
  File "C:\model\venve\Lib\site-packages\transformers\utils\import_utils.py", line 1292, in requires_backends
    raise ImportError("".join(failed))
ImportError:
T5Tokenizer requires the SentencePiece library but it was not found in your environment. Checkout the instructions on the
installation page of its repo: https://github.com/google/sentencepiece#installation and follow the ones
that match your environment. Please note that you may need to restart your runtime after installation.

当我写这个命令时,它给了我这个问题

python pip
1个回答
0
投票

sentencepiece
还不支持
python 3.12

最新版本于2023年5月2日发布。

您需要降级到

python 3.11

https://pypi.org/project/sentencepiece/

© www.soinside.com 2019 - 2024. All rights reserved.