Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
urllib.error.urleror:<;在使用Python3的Windows 10上使用urllib.request.urlretrieve()时出现urlopen错误[WinError 10060]_Python_Python 3.x_Windows_Windows 10_Urllib - Fatal编程技术网

urllib.error.urleror:<;在使用Python3的Windows 10上使用urllib.request.urlretrieve()时出现urlopen错误[WinError 10060]

urllib.error.urleror:<;在使用Python3的Windows 10上使用urllib.request.urlretrieve()时出现urlopen错误[WinError 10060],python,python-3.x,windows,windows-10,urllib,Python,Python 3.x,Windows,Windows 10,Urllib,代码: 错误:urllib.Error.URLError: 我已经在VSCode和Jupyter笔记本中使用python文件尝试了这段代码。我认为错误是由于Windows上的代理/防火墙设置造成的。我曾尝试禁用Windows Defender防火墙,也启用和禁用了各种代理设置,但运气不佳 大多数帖子在python2上都有这个错误-我还没有找到python3的修复程序。这看起来像是url中的一个小拼写错误,只是“githubusercontent”中缺少了一个“n” 当前: import os i

代码:

错误:
urllib.Error.URLError:

我已经在VSCode和Jupyter笔记本中使用python文件尝试了这段代码。我认为错误是由于Windows上的代理/防火墙设置造成的。我曾尝试禁用Windows Defender防火墙,也启用和禁用了各种代理设置,但运气不佳


大多数帖子在python2上都有这个错误-我还没有找到python3的修复程序。

这看起来像是url中的一个小拼写错误,只是“githubusercontent”中缺少了一个“n”

当前:

import os
import tarfile
from urllib.request import urlretrieve
import pandas as pd

download_root = "https://raw.githubusercotent.com/ageron/handson-ml2/master/"
housing_path = os.path.join("datasets", "housing")
housing_url = download_root + "datasets/housing/housing.tgz"

def fetch_housing_data(housing_url=housing_url, housing_path=housing_path):
    os.makedirs(housing_path, exist_ok=True)
    tgz_path = os.path.join(housing_path, "housing.tgz")
    urlretrieve(housing_url, tgz_path)
    housing_tgz = tarfile.open(tgz_path)
    housing_tgz.extractall(path=housing_path)
    housing_tgz.close()

def load_housing_data(housing_path=housing_path):
    csv_path = os.path.join(housing_path, "housing.csv")
    return pd.read_csv(csv_path)

fetch_housing_data()
housing = load_housing_data()
housing.head()
固定的:

download_root = "https://raw.githubusercotent.com/ageron/handson-ml2/master/"
download_root = "https://raw.githubusercontent.com/ageron/handson-ml2/master/"