我正在尝试获取 python 并设置一个环境来开展即将开展的项目。
在 Windows 10 Ubuntu bash 中,我成功运行以下命令:
sudo wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz
然后我解压它并输入一些其他命令,直到我发现在某个特定步骤中我需要 gcc,而我没有。所以我尝试以下命令:
sudo apt install gcc
但随后失败并显示以下错误消息:
Err:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 binutils amd64 2.26.1-1ubuntu1~16.04.4
Could not connect to archive.ubuntu.com:80 (2001:67c:1560:8001::14). - connect (111: Connection refused) [IP: 2001:67c:1560:8001::14 80]
Err:2 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libc-dev-bin amd64 2.23-0ubuntu9
Unable to connect to archive.ubuntu.com:http: [IP: 2001:67c:1560:8001::14 80]
Ign:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-libc-dev amd64 4.4.0-96.119
Ign:4 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libc6-dev amd64 2.23-0ubuntu9
81% [Connecting to security.ubuntu.com (91.189.88.161)]
Err:2 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libc-dev-bin amd64 2.23-0ubuntu9
Unable to connect to archive.ubuntu.com:http: [IP: 2001:67c:1560:8001::14 80]
Err:3 http://security.ubuntu.com/ubuntu xenial-security/main amd64 linux-libc-dev amd64 4.4.0-96.119
Unable to connect to archive.ubuntu.com:http: [IP: 2001:67c:1560:8001::14 80]
Err:4 http://security.ubuntu.com/ubuntu xenial-security/main amd64 libc6-dev amd64 2.23-0ubuntu9
Unable to connect to archive.ubuntu.com:http: [IP: 2001:67c:1560:8001::14 80]
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/b/binutils/binutils_2.26.1-1ubuntu1~16.04.4_amd64.deb Could not connect to archive.ubuntu.com:80 (2001:67c:1560:8001::14). - connect (111: Connection refused) [IP: 2001:67c:1560:8001::14 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/glibc/libc-dev-bin_2.23-0ubuntu9_amd64.deb Unable to connect to archive.ubuntu.com:http: [IP: 2001:67c:1560:8001::14 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev_4.4.0-96.119_amd64.deb Unable to connect to archive.ubuntu.com:http: [IP: 2001:67c:1560:8001::14 80]
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/g/glibc/libc6-dev_2.23-0ubuntu9_amd64.deb Unable to connect to archive.ubuntu.com:http: [IP: 2001:67c:1560:8001::14 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
我对此并不熟悉,在我看来,这似乎是某种连接问题。为什么我会遇到此故障,我该如何解决?任何建议都非常感谢!
答案1
问题很可能出在你使用的防火墙设置上,也可能出在你使用的 IPv4 和 IPv6 设置上。阅读:
https://www.reddit.com/r/bashonubuntuonwindows/comments/6h71ku/bash_aptget_wont_work/(最后一条评论)