在Windows11上安装句子转换器(使用最新版本的Python和pip)时出现以下错误.有没有人能帮个忙?查看了许多其他类似的帖子,但这些解决方案都不起作用.

C:\Users\abc\ai\llama\jupyterproj\stlit>py -m pip install sentence-transformers
Collecting sentence-transformers
  Using cached sentence_transformers-2.3.1-py3-none-any.whl.metadata (11 kB)
Collecting transformers<5.0.0,>=4.32.0 (from sentence-transformers)
  Using cached transformers-4.37.2-py3-none-any.whl.metadata (129 kB)
Requirement already satisfied: tqdm in c:\users\abc\appdata\local\programs\python\python312\lib\site-packages (from sentence-transformers) (4.66.2)
Requirement already satisfied: torch>=1.11.0 in c:\users\abc\appdata\local\programs\python\python312\lib\site-packages (from sentence-transformers) (2.2.0)
Requirement already satisfied: numpy in c:\users\abc\appdata\local\programs\python\python312\lib\site-packages (from sentence-transformers) (1.26.4)
Collecting scikit-learn (from sentence-transformers)
  Using cached scikit_learn-1.4.0-1-cp312-cp312-win_amd64.whl.metadata (11 kB)
Collecting scipy (from sentence-transformers)
  Using cached scipy-1.12.0-cp312-cp312-win_amd64.whl.metadata (60 kB)
Collecting nltk (from sentence-transformers)
  Using cached nltk-3.8.1-py3-none-any.whl (1.5 MB)
Collecting sentencepiece (from sentence-transformers)
  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\abc\AppData\Local\Temp\pip-install-3n9shirh\sentencepiece_fc383392079e43b6a8c226f0484c0928\setup.py", line 126, in <module>
          subprocess.check_call([
        File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 408, in check_call
          retcode = call(*popenargs, **kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 389, in call
          with Popen(*popenargs, **kwargs) as p:
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\abc\AppData\Local\Programs\Python\Python312\Lib\subprocess.py", line 1026, in __init__
          self._execute_child(args, executable, preexec_fn, close_fds,
        File "C:\Users\abc\AppData\Local\Programs\Python\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]

注意:这个错误来自一个子进程,可能不是pip的问题. 错误:元数据生成失败

*生成程序包元数据时遇到错误. ╰─&gt;的输出见上文.

注意:这是上面提到的包的问题,而不是pip. 提示:有关详细信息,请参阅上文.

推荐答案

你需要用python 3.11来安装sentence-transformers

它依赖于 torch

100

目前,Windows上的PyTorch仅支持Python3.8-3.11;不支持Python2.x.

100

我们建议使用Python3.8或更高版本、PyTorch 1.11.0或更高版本以及转换器v4.32.0或更高版本.该代码不适用于Python2.7

Python相关问答推荐

Pythind 11无法弄清楚如何访问tuple元素

通过优化空间在Python中的饼图中添加标签

即使在可见的情况下也不相互作用

rame中不兼容的d类型

ModuleNotFound错误:没有名为flags.State的模块; flags不是包

当独立的网络调用不应该互相阻塞时,'

如果值发生变化,则列上的极性累积和

Python+线程\TrocessPoolExecutor

Django—cte给出:QuerySet对象没有属性with_cte''''

当单元测试失败时,是否有一个惯例会抛出许多类似的错误消息?

Pandas—MultiIndex Resample—我不想丢失其他索引的信息´

BeautifulSoup:超过24个字符(从a到z)的迭代失败:降低了首次深入了解数据集的复杂性:

在我融化极点数据帧之后,我如何在不添加索引的情况下将其旋转回其原始形式?

read_csv分隔符正在创建无关的空列

Pandas:将值从一列移动到适当的列

在pandas中,如何在由两列加上一个值列组成的枢轴期间或之后可靠地设置多级列的索引顺序,

一维不匹配两个数组上的广义ufunc

从列表中分离数据的最佳方式

我怎样才能让深度测试在OpenGL中使用Python和PyGame呢?

将数据从一个单元格保存到Jupyter笔记本中的下一个单元格