You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [18 lines of output]
/private/var/folders/fh/htk44s8s3zn1_r69580xb8f80000gn/T/pip-install-xry9fjhj/pyfolio_56a77d3c176b4d7f9fcc6280843d200f/versioneer.py:468: SyntaxWarning: invalid escape sequence '\s'
LONG_VERSION_PY['git'] = '''
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/private/var/folders/fh/htk44s8s3zn1_r69580xb8f80000gn/T/pip-install-xry9fjhj/pyfolio_56a77d3c176b4d7f9fcc6280843d200f/setup.py", line 71, in
version=versioneer.get_version(),
^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/fh/htk44s8s3zn1_r69580xb8f80000gn/T/pip-install-xry9fjhj/pyfolio_56a77d3c176b4d7f9fcc6280843d200f/versioneer.py", line 1407, in get_version
return get_versions()["version"]
^^^^^^^^^^^^^^
File "/private/var/folders/fh/htk44s8s3zn1_r69580xb8f80000gn/T/pip-install-xry9fjhj/pyfolio_56a77d3c176b4d7f9fcc6280843d200f/versioneer.py", line 1341, in get_versions
cfg = get_config_from_root(root)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/fh/htk44s8s3zn1_r69580xb8f80000gn/T/pip-install-xry9fjhj/pyfolio_56a77d3c176b4d7f9fcc6280843d200f/versioneer.py", line 399, in get_config_from_root
parser = configparser.SafeConfigParser()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
[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.
Using cached pyfolio-0.9.2.tar.gz (91 kB)
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]
/private/var/folders/fh/htk44s8s3zn1_r69580xb8f80000gn/T/pip-install-xry9fjhj/pyfolio_56a77d3c176b4d7f9fcc6280843d200f/versioneer.py:468: SyntaxWarning: invalid escape sequence '\s'
LONG_VERSION_PY['git'] = '''
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/private/var/folders/fh/htk44s8s3zn1_r69580xb8f80000gn/T/pip-install-xry9fjhj/pyfolio_56a77d3c176b4d7f9fcc6280843d200f/setup.py", line 71, in
version=versioneer.get_version(),
^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/fh/htk44s8s3zn1_r69580xb8f80000gn/T/pip-install-xry9fjhj/pyfolio_56a77d3c176b4d7f9fcc6280843d200f/versioneer.py", line 1407, in get_version
return get_versions()["version"]
^^^^^^^^^^^^^^
File "/private/var/folders/fh/htk44s8s3zn1_r69580xb8f80000gn/T/pip-install-xry9fjhj/pyfolio_56a77d3c176b4d7f9fcc6280843d200f/versioneer.py", line 1341, in get_versions
cfg = get_config_from_root(root)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/fh/htk44s8s3zn1_r69580xb8f80000gn/T/pip-install-xry9fjhj/pyfolio_56a77d3c176b4d7f9fcc6280843d200f/versioneer.py", line 399, in get_config_from_root
parser = configparser.SafeConfigParser()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser'?
[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.
从你给出的错误信息来看,在安装
pyfolio-0.9.2
时,由于versioneer.py
文件里使用了 Python 2 中已弃用的SafeConfigParser
类,而在 Python 3 中该类已不存在,从而引发了AttributeError
。以下是针对开发者的一些建议:代码层面
versioneer.py
文件中所有使用SafeConfigParser
的地方替换为ConfigParser
,因为在 Python 3 里ConfigParser
替代了SafeConfigParser
。示例如下:setup.py
或者项目的README
文件中,明确标注项目支持的 Python 版本范围。并且在代码里添加版本兼容性检查逻辑,当用户使用不兼容的 Python 版本安装时,给出清晰的错误提示。示例代码如下:pyproject.toml
来替代传统的setup.py
,pyproject.toml
是 Python 社区推荐的项目配置文件,它可以更好地管理项目的依赖和构建配置。同时,遵循 PEP 517 和 PEP 518 规范,确保项目在不同的 Python 环境中都能正确构建和安装。文档层面
README
文件或者官方文档中,明确指出安装项目所需的 Python 版本和依赖项。如果有特定的安装步骤或者注意事项,也要详细说明。测试和反馈机制
pytest
对项目进行单元测试、集成测试和兼容性测试。确保在不同的 Python 版本和操作系统环境下,项目都能正常运行。Issues
页面、项目的官方论坛或者邮件列表。鼓励用户在遇到问题时及时反馈,开发者可以根据用户反馈快速修复问题。通过以上建议,开发者可以提高
pyfolio
项目的兼容性和稳定性,减少用户在安装和使用过程中遇到的问题。The text was updated successfully, but these errors were encountered: