wsl安装问题记录及解决办法

fatal: unable to access ‘xxxxx/’:

之前在安装wsl时参考教程修改了ip,但忘记怎么修改回来,现在有时会报错:fatal: unable to access ‘xxxxx/’:
Unsupported proxy syntax in ‘:7890’

1.清空现有代理设置

unset http_proxy
unset https_proxy
unset HTTP_PROXY
unset HTTPS_PROXY
unset ftp_proxy

2.检查代理是否清空

echo $http_proxy
echo $https_proxy
	无输出表示清空

3.在win系统下找到代理设置
设置-网络和Internet-代理-手动代理设置里面有个端口
用管理员权限进入PowerShell执行命令:ipconfig
找到以太网适配器 vEthernet (WSL (Hyper-V firewall)):下的IPv4地址,通常为 192.168.x.x

4.在 WSL 中设置代理环境变量:

export http_proxy="http://192.168.x.x:7897"
export https_proxy="http://192.168.x.x:7897"

5.测试网络连接

curl -I https://www.google.com
如果返回HTTP头信息,表示代理设置正确

6.更新conda配置
将代理添加到conda配置文件~/.condarc 中:

proxy_servers:
  		http: http://192.168.x.x:7897
  		https: http://192.168.x.x:7897

7.创建conda环境

8.永久设置代理

echo 'export http_proxy="http://192.168.x.x:7897"' >> ~/.bashrc
echo 'export https_proxy=" http://192.168.x.x:7897"' >> ~/.bashrc
source ~/.bashrc

HTTP000

ProxyError: Conda cannot proceed due to an error in your proxy configuration. Check for typos and other configuration errors in any ‘.netrc’ file in your home directory, any environment variables ending in ‘_PROXY’, and any other system-wide proxy configuration settings.

1、检查代理:

echo $HTTP_PROXY
echo $HTTPS_PROXY
echo $http_proxy
echo $https_proxy

2、清除所有代理:

unset HTTP_PROXY
unset HTTPS_PROXY
unset http_proxy
unset https_proxy

3、删除 .condarc 文件中的代理设置

nano ~/.condarc

4、删掉:

proxy_servers:
  http: http://your-proxy-server:port
  https: https://your-proxy-server:port

5、确保.netrc文件没有输出

cat ~/.netrc

6、更新conda:

conda update conda

当wsl安装到C盘导致C盘过满

WSL迁移到非系统盘
wsl的安装及迁移至其他盘
执行到最后一步出现:

Installing, this may take a few minutes… WslRegisterDistribution
failed with error: 0x80070050 Error: 0x80070050 ???

解决办法:
error:0x80070050 Error: 0x80070050
重新根据微软官网进行命令

wsl --set-default-version 2

wsl: 检测到 localhost 代理配置,但未镜像到 WSL。NAT 模式下的 WSL 不支持 localhost 代理。​

在Windows中的C:\Users<your_username>目录下创建一个.wslconfig文件,然后在文件中写入如下内容

[experimental]
autoMemoryReclaim=gradual    # gradual  | dropcache | disabled
networkingMode=mirrored
dnsTunneling=true
firewall=true
autoProxy=true

命令行输入

wsl --shutdown

重启

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值