Python3

使用 GUI 自動化控制鍵盤和滑鼠 - 安裝

  • October 13, 2019

請問這裡有什麼問題?我嘗試安裝https://automatetheboringstuff.com/chapter18/

sudo pip3 install --user python3-xlib
Traceback (most recent call last):
 File "/usr/bin/pip3", line 9, in <module>
   from pip import main
ImportError: cannot import name 'main'
Error in sys.excepthook:
Traceback (most recent call last):
 File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 145, in apport_excepthook
   os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o640), 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/var/crash/_usr_bin_pip3.0.crash'

Original exception was:
Traceback (most recent call last):
 File "/usr/bin/pip3", line 9, in <module>
   from pip import main
ImportError: cannot import name 'main'

使用 pip3 安裝另一個程序會導致錯誤:

pip3 install python3-tk
Collecting python3-tk
 ERROR: Could not find a version that satisfies the requirement python3-tk (from versions: none)
ERROR: No matching distribution found for python3-tk

正如我所見python3-tk,不是Pypi的可用包,所以第二個錯誤是“正常”。

對於第一個,您將sudo呼叫與--user標誌混合在一起。我真的不知道內部結構,pip但嘗試刪除其中一個:要麼sudo pip install要麼pip install --user.

引用自:https://unix.stackexchange.com/questions/546547