我正在尝试执行命令
pip3/pip install -win_requirements.txt
,我发现 email
模块是问题所在。
错误如下:
pip3 install email
Defaulting to user installation because normal site-packages is not writeable
Collecting email
Using cached email-4.0.2.tar.gz (1.2 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 14, in <module>
File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 15, in <module>
import setuptools.version
File "/usr/lib/python3/dist-packages/setuptools/version.py", line 1, in <module>
from ._importlib import metadata
File "/usr/lib/python3/dist-packages/setuptools/_importlib.py", line 45, in <module>
import importlib.metadata as metadata # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 17, in <module>
from . import _adapters, _meta
File "/usr/lib/python3.11/importlib/metadata/_adapters.py", line 3, in <module>
import email.message
File "/tmp/pip-install-lzxy69gd/email_f38b626eeefa44a098244f34710a1052/email/message.py", line 255
if str(charset) <> charset.get_output_charset():
^^
SyntaxError: invalid syntax
[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.
您正在尝试安装包“email”,它是需求文件的一部分(据我所知应该是win_requirements.txt)。
软件包附带一个安装脚本,该脚本有语法错误:
"/tmp/pip-install-lzxy69gd/email_f38b626eeefa44a098244f34710a1052/email/message.py", line 255 if str(charset) <> charset.get_output_charset(): ^^ SyntaxError: invalid syntax [end of output]
他们使用“<>”而不是“!=”;所以维护者需要修复它。您可以做的是,通过附加
打开需求文件“win_requirements.txt”(或任何名称)并找到“email”行并将其替换为“email”<4.0.2". Then it should use the latest version before 4.0.2... if thats not working, you can specify any older version. Try e.g. <4.0.0 to install the latest 3.x.x revision.