/usr/libからpython3.9フォルダを削除しましたが、再インストールできません。

/usr/libからpython3.9フォルダを削除しましたが、再インストールできません。

私は愚かな間違いを犯し、/ usr / binからpython3.9フォルダと他のフォルダを削除しました(私がなぜこれをしたのか冗長です)。

実行して再インストールしようとすると、sudo apt install python3.9スクリーンショットにこのエラーが表示されます。

Python3.9の再インストール中にエラーが発生しました。

この「ブルーマン」が何であるかわからないので、Pythonを再インポートしたいのですが、方法がわからないので問題を解決するのに助けが必要です.

フル出力:

[sudo] password for yahia: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3.9 is already the newest version (3.9.1-4).
The following packages were automatically installed and are no longer required:
  libaom0:i386 libcodec2-0.9 libcodec2-0.9:i386 libdav1d4:i386
  libdbusmenu-qt5-2 libjs-excanvas libjs-jquery-flot
  libpcre3:i386 libvpx6:i386 libwavpack1:i386 libx264-160:i386
  libx265-192:i386
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2343 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up blueman (2.1.4-1+b1) ...
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/usr/bin/python3'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/usr/bin/python3'
  sys.base_prefix = '/usr'
  sys.base_exec_prefix = '/usr'
  sys.platlibdir = 'lib'
  sys.executable = '/usr/bin/python3'
  sys.prefix = '/usr'
  sys.exec_prefix = '/usr'
  sys.path = [
    '/usr/lib/python39.zip',
    '/usr/lib/python3.9',
    '/usr/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x00007fd8882db740 (most recent call first):
<no Python frame>
dpkg: error processing package blueman (--configure):
 installed blueman package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 blueman
E: Sub-process /usr/bin/dpkg returned an error code (1)

ベストアンサー1

システムはまだpython3.9それがインストールされていると思います:

python3.9 is already the newest version (3.9.1-4).

パッケージを削除せずにファイルを削除する場合、これは意味があります。したがって、明示的に再インストールする必要があります。

sudo apt reinstall python3.9

削除した他のファイルによっては、別のパッケージを再インストールする必要があります。インストールしたすべてのPythonパッケージを再インストールする方法は次のとおりです。

sudo apt reinstall $(dpkg-query -W \*python\* | awk '$2 { print $1 }')

おすすめ記事