我最近把我的系统从Ubuntu18.04升级到了20.04.之后,我try 使用shell命令here更新我的所有pip3包(我将"pip"改为"pip3").

在更新了几个软件包后,出现了以下提示:

因为我在更新/安装软件包时从未见过它,所以我取消了它,导致同一提示符立即重新打开,终端显示以下警告:

WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!

我按下CTRL+C键,它试图安装的下一个软件包也发生了同样的情况.自从我try 安装软件包后,同样的情况也发生了.

例子:

pip3 install numpy
WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!
WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!
Collecting numpy
  WARNING: Keyring is skipped due to an exception: Failed to unlock the keyring!
  Using cached numpy-1.19.2-cp38-cp38-manylinux2010_x86_64.whl (14.5 MB)
Installing collected packages: numpy
  WARNING: The scripts f2py, f2py3 and f2py3.8 are installed in '/home/gesuchter/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.19.2

我已经try 通过重新安装python3 pip来解决我的问题.

以下是一些有用的信息:

pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

ls ~/.local/share/keyrings
default  login.keyring  user.keystore

find ~/.config/kwalletrc
find: ‘/home/gesuchter/.config/kwalletrc’: No such file or directory

推荐答案

这为我解决了问题:

python3 -m keyring --disable

运行它会增加:

[backend]
default-keyring=keyring.backends.null.Keyring

到文件~/.config/python_keyring/keyringrc.cfg.

据推测,https://stackoverflow.com/a/68504137/895245中提到的PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring 提供了一种环境变量方法来实现相同的结果.

如果没有这个,每次我try 安装软件包时,它都会显示恼人的KDE密钥环弹出窗口:

enter image description here

谷歌,索引如下:

KDE钱包系统

应用程序'/usr/lib/python3/dist-packages/pip/__main__.py'请求创建一个名为"kdewallet"的新钱包.这用于以安全的方式存储敏感数据.请在下面 Select 新钱包的类型,或单击"取消"拒绝应用程序的请求.

  • classic 的河豚加密文件
  • 使用GPG加密,以获得更好的保护

相关:https://askubuntu.com/questions/1205161/annoying-kde-wallet-service-popup-the-application-kded5-has-requested-to-open

在Ubuntu 21.04、Python 3.9.5、pip3 20.3.4、keyring==22.2.0上测试.

Python-3.x相关问答推荐

海象表达可以放在方括号中而不是括号中吗?

使用数据库将文件从Sharepoint下载到文件系统

我用Kivy创建的应用程序在安卓系统上运行时出错.(attributeerror:';class';对象没有属性';_javaclass__cls_storage';)

ValueError at /register/ 视图authenticate.views.register_user 未返回HttpResponse 对象.它返回 None 相反

如何使用正则表达式通过反向搜索从链接中获取特定文本

重复数组直到一定长度 groupby pandas

如何获取自定义文件上传路径的对象ID?

根据按不同列中的值分组的平均值划分 DataFrame

如何在两个矩阵的比较中允许任何列的符号差异,Python3?

使用正则表达式提取字符串之间的文本

使用 Python 解析 JSON 嵌套字典

Seaborn:注释线性回归方程

两个Pandas数据框中的共同列列表

Python过滤器函数 - 单个结果

Pandas 的 EMA 与股票的 EMA 不匹配?

导入 python 模块而不实际执行它

如何使用 d.items() 更改 for 循环中的所有字典键?

无论如何我可以在 Google colaboratory 中下载文件吗?

在 Python 3 中调用 super() 的 4 种方法中的哪一种?

如何在python中创建代码对象?