当我运行 /usr/bin/click 时,出现以下错误:
Traceback (most recent call last):
File "/usr/bin/click", line 37, in <module>
import click
ImportError: No module named 'click'
我尝试重新安装包 click,但是在安装过程中出现同样的错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/14,7 kB of archives.
After this operation, 0 B of additional disk space will be used.
(Reading database ... 255715 files and directories currently installed.)
Preparing to unpack .../click_0.4.45.1+16.10.20160916-0ubuntu1_amd64.deb ...
Unpacking click (0.4.45.1+16.10.20160916-0ubuntu1) over (0.4.45.1+16.10.20160916-0ubuntu1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up click (0.4.45.1+16.10.20160916-0ubuntu1) ...
Traceback (most recent call last):
File "/usr/bin/click", line 37, in <module>
import click
ImportError: No module named 'click'
dpkg: error processing package click (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for shared-mime-info (1.7-1) ...
Errors were encountered while processing:
click
E: Sub-process /usr/bin/dpkg returned an error code (1)
我已经删除了另一个click
来自 pip3 的包,但这没有帮助。似乎需要的文件(我相信它们的来源是这里) 在系统中不存在或者 Python 无法找到它。
所以问题是:python 包click
应该位于哪里,以及如何修复错误。
答案1
我终于找到了解决方案!在我的例子中,python 模块click
来自 aptitude 包python3-click-package
。然而,它已被另一个模块覆盖click
。在我删除了后一个模块之后,python3-click-package
它就坏了,所以我只是重新安装了它,click
现在就可以正常工作了:
sudo apt install --reinstall python3-click-package