Arch Linux下使用pipx安装kate-plugins失败求助
我在Arch Linux系统中尝试通过pipx安装kate-plugins,但安装过程失败。报错显示pip无法构建pysmell==0.7.3包,核心错误为:SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
完整pip日志信息如下:
Fatal error from pip prevented installation. Full pip output in file:
/home/tahayasseradnan/.local/state/pipx/log/cmd_2024-06-12_23.10.20_pip_errors.logpip seemed to fail to build package:
pysmell==0.7.3Some possibly relevant errors from pip install:
error: subprocess-exited-with-error
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?Error installing kate-plugins.
PIP STDOUT ---------- Collecting kate-plugins Using cached Kate-plugins-0.2.3.tar.gz (211 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'done' Installing backend dependencies: started Installing backend dependencies: finished with status 'done' Preparing metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting pysmell==0.7.3 (from kate-plugins) Using cached pysmell-0.7.3.zip (48 kB) Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' PIP STDERR ---------- error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [22 lines of output] Traceback (most recent call last): File "/home/tahayasseradnan/.local/share/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module> main() File "/home/tahayasseradnan/.local/share/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/tahayasseradnan/.local/share/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) ^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-p0emiyie/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-p0emiyie/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-p0emiyie/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 487, in run_setup super().run_setup(setup_script=setup_script) File "/tmp/pip-build-env-p0emiyie/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup exec(code, locals()) File "<string>", line 27 print post_install_message ^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)? [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip
错误原因
pysmell==0.7.3是2009年发布的老旧包,完全采用Python 2语法(print语句不带括号),而当前使用的Python 3.12不兼容该语法,导致构建失败。
方法一:使用Python 2环境安装
Arch Linux官方仓库仍提供Python 2,可指定该环境安装kate-plugins:
- 安装Python 2及对应pip:
sudo pacman -S python2 python2-pip - 用pipx指定Python 2环境安装:
若pipx对Python 2支持不佳,可直接用Python 2的pip安装到用户目录:pipx install --python python2 kate-pluginspython2 -m pip install --user kate-plugins
方法二:手动修改pysmell代码兼容Python 3
手动修复pysmell的语法问题后本地安装:
- 从PyPI下载pysmell==0.7.3的源码包
- 解压并进入源码目录:
unzip pysmell-0.7.3.zip && cd pysmell-0.7.3 - 编辑
setup.py文件,找到第27行的print post_install_message,改为Python 3兼容写法:print(post_install_message) - 本地安装修改后的pysmell:
pipx install . - 重新安装kate-plugins:
pipx install kate-plugins
方法三:寻找替代方案
kate-plugins 0.2.3同样是2010年的老旧包,已停止维护。可考虑:
- 查看KDE官方的Kate插件仓库,寻找功能类似的现代插件
- 搜索代码托管平台,查看是否有kate-plugins或pysmell的维护分支版本
内容的提问来源于stack exchange,提问作者tahadnan

