web-dev-qa-db-ja.com

Ubuntu 18.04はpython3 tkinterをインストールできません

Lubuntu 18.04 python3バージョンは3.6.10です

~$ python3 --version
Python 3.6.10

Tkinterモジュールをインストールしようとすると、3.6.9バージョンを指しているように見えて失敗しました。

~$ Sudo apt-get install python3.6-tk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'python3-tk' instead of 'python3.6-tk'
Suggested packages:
  tix python3-tk-dbg
The following NEW packages will be installed:
  python3-tk
0 to upgrade, 1 to newly install, 0 to remove and 23 not to upgrade.
Need to get 119 kB of archives.
After this operation, 1,324 kB of additional disk space will be used.
Get:1 http://au.archive.ubuntu.com/ubuntu bionic-updates/main AMD64 python3-tk AMD64 3.6.9-1~18.04 [119 kB]
Fetched 119 kB in 0s (599 kB/s)    
(Reading database ... 481569 files and directories currently installed.)
Preparing to unpack .../python3-tk_3.6.9-1~18.04_AMD64.deb ...
Unpacking python3-tk:AMD64 (3.6.9-1~18.04) ...
dpkg: error processing archive /var/cache/apt/archives/python3-tk_3.6.9-1~18.04_AMD64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.6/tkinter/__init__.py', which is also in package libpython3.6-stdlib:AMD64 3.6.10-1+xenial1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/python3-tk_3.6.9-1~18.04_AMD64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

apt-cache:

~$ apt-cache policy libpython3.6-stdlib python3-tk
libpython3.6-stdlib:
  Installed: 3.6.10-1+xenial1
  Candidate: 3.6.10-1+xenial1
  Version table:
 *** 3.6.10-1+xenial1 100
        100 /var/lib/dpkg/status
     3.6.9-1~18.04 500
        500 http://au.archive.ubuntu.com/ubuntu bionic-updates/main AMD64 Packages
     3.6.8-1~18.04.3 500
        500 http://security.ubuntu.com/ubuntu bionic-security/main AMD64 Packages
     3.6.5-3 500
        500 http://au.archive.ubuntu.com/ubuntu bionic/main AMD64 Packages
python3-tk:
  Installed: (none)
  Candidate: 3.6.9-1~18.04
  Version table:
     3.6.9-1~18.04 500
        500 http://au.archive.ubuntu.com/ubuntu bionic-updates/main AMD64 Packages
     3.6.5-3 500
        500 http://au.archive.ubuntu.com/ubuntu bionic/main AMD64 Packages

$ Sudo apt-get install libpython3.6-stdlib=3.6.9-1~18.04
[Sudo] password for gdhp: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libpython3.6-stdlib : Depends: libpython3.6-minimal (= 3.6.9-1~18.04) but 3.6.10-1+xenial1 is to be installed
E: Unable to correct problems, you have held broken packages.
[1]+  Done                    code .


$ Sudo apt-get install python3-tk
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  tix python3-tk-dbg
The following NEW packages will be installed:
  python3-tk
0 to upgrade, 1 to newly install, 0 to remove and 23 not to upgrade.
Need to get 0 B/119 kB of archives.
After this operation, 1,324 kB of additional disk space will be used.
(Reading database ... 481569 files and directories currently installed.)
Preparing to unpack .../python3-tk_3.6.9-1~18.04_AMD64.deb ...
Unpacking python3-tk:AMD64 (3.6.9-1~18.04) ...
dpkg: error processing archive /var/cache/apt/archives/python3-tk_3.6.9-1~18.04_AMD64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.6/tkinter/__init__.py', which is also in package libpython3.6-stdlib:AMD64 3.6.10-1+xenial1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/python3-tk_3.6.9-1~18.04_AMD64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
1
artm

だから私は公式のUbuntuリポジトリからパッケージをインストールすることをお勧めします:

Sudo apt-get install libpython3.6-stdlib=3.6.9-1~18.04
Sudo apt-get install python3-tk
1
N0rbert