add-apt-repositoryがPythonエラーを発生させます

add-apt-repositoryがPythonエラーを発生させます

Numixアイコンのテーマをインストールしたいので、ppaを追加する必要がありますが、奇妙なことに、次のエラーが発生します。

Traceback (most recent call last):
  File "/usr/bin/add-apt-repository", line 163, in <module>
    if not sp.add_source_from_shortcut(shortcut, options.enable_source):
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 750, in add_source_from_shortcut
    self.set_modified_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 484, in set_modified_sourceslist
    self.save_sourceslist()
  File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 650, in save_sourceslist
    self.sourceslist.save()
  File "/usr/lib/python3/dist-packages/aptsources/sourceslist.py", line 415, in save
    files[source.file] = open(source.file, "w")
FileNotFoundError: [Errno 2] Böyle bir dosya ya da dizin yok: '/etc/apt/sources.list.d/numix-ppa-trusty.list'

コードでは、Pythonが設定ファイルを開こうとしますが、見つからないため生成できないことを理解しています。 (何の関係なのか…)

このエラーの原因は何ですか?それを処理する方法?また、LinuxはPythonを使用してリポジトリコマンドを実行します(もっと楽しいからです)?

このコードを実行しました。

sudo apt-add-repository ppa:numix/ppa
sudo apt-get update
sudo apt-get install numix-icon-theme numix-icon-theme-circle

オペレーティングシステム:Xubuntu 14.04 LTS

編集:ソース。リストの編集

このコードを実行するたびに、https://launchpad.net/~numix/+archive/ubuntu/ppa協会。だから私はsource.listで次のことを試しました。

###############################################
# Number One: Add The Link To The End Of File #
###############################################
deb https://launchpad.net/~numix/+archive/ubuntu/ppa trusty partner
deb-src deb https://launchpad.net/~numix/+archive/ubuntu/ppa trusty partner
# I used "deb", "deb-src" and "trusty partner" patterns to achieve my goal, but it failed.

###################################
# Number Two: Change Link Pattern #
###################################
deb https://launchpad.net/~numix/+archive/ubuntu trusty partner
deb-src deb https://launchpad.net/~numix/+archive/ubuntu trusty partner
# I also tried those since other repository links ends with "ubuntu" instead of "ppa" but this also failed.

ベストアンサー1

そのディレクトリがシステムから欠落しているようです/etc/apt/sources.list.d(を使用してこれを確認できますls /etc/apt/sources.list.d。「該当するファイルまたはディレクトリが見つかりません」とマークする必要があります)。その場合は、次のコマンドを使用して再生成します。

sudo mkdir /etc/apt/sources.list.d

それからもう一度やり直してください。

おすすめ記事