我按照此处的说明删除并重新安装了 Ubuntu,但即使在我重新安装 Ubuntu 之后,pip 安装的相同问题仍然存在。我怀疑重新安装过程并没有完全帮助我删除 Ubuntu。
需要明确的是,我正在安装的 Ubuntu 是一个 bash shell,而不是需要分区的磁盘映像 - 在我的情况下,只需从 Windows Store 下载 Ubuntu 的副本即可
如何彻底删除(Windows 10 版本 10.0.17763 Build 17763)上的所有 Ubuntu bash 文件?
我重新安装的步骤是:
我见过其他卸载方法,例如wslconfig.exe /u Ubuntu
,但由于 Fall Creators 更新允许使用此方法,因此我采用了上述方法。我不确定它们之间有什么区别,以及它是否会对我的情况产生影响。
但是,同样的 pip 问题仍然存在,这种重新安装方式是否能保证我获得全新的 python 环境副本?我可能做错了什么?
我想重新安装 Ubuntu 的原因是因为我的 pip 仅在 Ubuntu 上不能正常运行,而不能在 Windows 操作系统上正常运行。例子如下:例子
任何建议将不胜感激。谢谢!
有关我尝试对 pip 安装进行故障排除的其他内容的更多详细信息
缓存
有些人推荐使用--no-cache-dir
但它没有用,我什至尝试过rm -rf ./cache/pip
但也没有用。所以我重新安装了 Ubuntu WSL,希望它能工作,但它没有。
网络问题
ping pypi.org
不起作用并返回以下消息并冻结 PING pypi.python.org(2a04:4e42:2::223 (2a04:4e42:2::223)) 56 data bytes
我对这个问题做了什么:
1.尝试按照@Kulfy 此处的建议禁用 IPv6
得到以下错误:
sysctl: cannot stat /proc/sys/net/ipv6/conf/all/disable_ipv6: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv6/conf/default/disable_ipv6: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv6/conf/lo/disable_ipv6: No such file or directory
2.将以下内容复制并粘贴到Ubuntu中:使用以下命令尝试使用sudo和root
须藤/根
cat >/etc/modprobe.d/blacklist-ipv6.conf <<EOF
# Turn of IPv6 by blacklisting the module.
# Even though it isn't needed.
blacklist ipv6
EOF
$
它返回以下内容 -bash: /etc/modprobe.d/blacklist-ipv6.conf: Permission denied
我还通过取消注释这些代码并通过执行以下操作来编辑文件来设置 IPv4 首选项
sudo vi /etc/gai.conf
然后……取消注释
#For sites which prefer IPv4 connections change the last line to
precedence ::ffff:0:0/96 100
...
# For sites which use site-local IPv4 addresses behind NAT there is
# the problem that even if IPv4 addresses are preferred they do not
# have the same scope and are therefore not sorted first. To change
# this use only these rules:
#
scopev4 ::ffff:169.254.0.0/112 2
scopev4 ::ffff:127.0.0.0/104 2
scopev4 ::ffff:0.0.0.0/96 14
这是这里推荐的
这仍然没有奏效。所以,这可能不是 IPv6 的问题
就我而言,我意识到即使重新安装后,问题仍然存在。但是,我意识到 Hamachi 的 LogMeIn 客户端未处于离线模式,这导致其以太网连接干扰了 Ubuntu 的 Internet 连接(但在 Windows 操作系统上不会)。这就是为什么当我 pinggoogle.com
它返回PING google.com(2404:6800:4003:c03::8a (2404:6800:4003:c03::8a)) 56 data bytes
并停止时。@Kulfy 为帮助排除故障而采取的步骤为我指明了正确的方向,这让我意识到有一个额外的以太网连接正在运行。
将来,如果有人仍然面临互联网连接问题,即使在重新安装后,请检查您是否没有同时运行任何防病毒软件或其他服务器,这可能会干扰您的 Ubuntu 互联网连接。
转到控制面板→网络和 Internet→ Windows 上的网络连接以检查是否有其他服务器正在运行。禁用它们(如果找到)并重试。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句