超时错误:[WinError 10060]

问题描述 投票:0回答:1
    DOWNLOAD_ROOT = "https://raw.githubusercontent.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):
        if not os.path.isdir(housing_path):
            os.makedirs(housing_path)
        tgz_path = os.path.join(housing_path, "housing.tgz")
        urllib.request.urlretrieve(housing_url, tgz_path)
        housing_tgz = tarfile.open(tgz_path)
        housing_tgz.extractall(path=housing_path)
        housing_tgz.close()
    fetch_housing_data()
    import pandas as pd
    def load_housing_data(housing_path=HOUSING_PATH):
        csv_path = os.path.join(housing_path,"housing.csv")
        return pd.read_csv(csv_path)
    housing = load_housing_data()

我已经运行了这段代码,但我收到错误

“TimeoutError: [WinError 10060] 连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接的主机未能响应而建立的连接失败”

“网址错误:

有人可以帮我解决这个代码吗?

pandas machine-learning
1个回答
0
投票

[WinError 10060] 对于在图书馆工作或使用公共 wifi 的学生来说,这是行不通的,我尝试了我能找到的所有方法,之后就使用了我自己的互联网,即使它有点烦人,但它工作了,祝你好运

© www.soinside.com 2019 - 2024. All rights reserved.