从控制台安装 Java

从控制台安装 Java

我尝试按照以下说明安装 Java:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

但是在 sudo add-apt-repository ppa:webupd8team/java 之后我收到错误:

Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 11, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
ModuleNotFoundError: No module named 'softwareproperties'

我已经检查过“ls -l /usr/bin/python*”:

lrwxrwxrwx 1 root root        9 гру 21 12:16 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root        9 гру 21 12:16 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root  3546104 лис 19 11:35 /usr/bin/python2.7
lrwxrwxrwx 1 root root       33 лис 19 11:35 /usr/bin/python2.7-config ->    x86_64-linux-gnu-python2.7-config
lrwxrwxrwx 1 root root       16 гру 10  2015 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root        9 січ  8 20:31 /usr/bin/python3 -> python3.6
-rwxr-xr-x 2 root root  4460336 лис 17 21:23 /usr/bin/python3.5
lrwxrwxrwx 1 root root       33 лис 17 21:23 /usr/bin/python3.5-config -> x86_64-linux-gnu-python3.5-config
-rwxr-xr-x 2 root root  4460336 лис 17 21:23 /usr/bin/python3.5m
lrwxrwxrwx 1 root root       34 лис 17 21:23 /usr/bin/python3.5m-config -> x86_64-linux-gnu-python3.5m-config
-rwxr-xr-x 2 root root 12504344 січ  8 20:31 /usr/bin/python3.6
lrwxrwxrwx 1 root root       17 січ  8 20:31 /usr/bin/python3.6-config -> python3.6m-config
-rwxr-xr-x 2 root root 12504344 січ  8 20:31 /usr/bin/python3.6m
-rwxr-xr-x 1 root root     3091 січ  8 20:31 /usr/bin/python3.6m-config
lrwxrwxrwx 1 root root       16 січ  8 20:31 /usr/bin/python3-config -> python3.6-config
lrwxrwxrwx 1 root root       10 гру 21 12:16 /usr/bin/python3m -> python3.5m
lrwxrwxrwx 1 root root       17 бер 23  2016 /usr/bin/python3m-config -> python3.5m-config
lrwxrwxrwx 1 root root       16 гру 10  2015 /usr/bin/python-config -> python2.7-config

有人遇到过这样的问题吗?

答案1

您是否安装了软件属性?

尝试:

apt-get install -y python-software-properties software-properties-common software-properties-gtk python3-software-properties software-properties-kde

相关内容