0

我运行下面的代码并在该区域得到错误:“from Six.moves import usrllib”我该如何解决这个问题?

--------这是我的代码--------

import os
import tarfile
from six.moves import usrllib

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"

create housing_url ,housing_path
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()

-----这是错误--------


ImportError Traceback(最近一次调用最后)/var/folders/sg/vkph2xk90vz9179b84hndgn80000gn/T/ipykernel_4539/1326320674.py in 1 import os 2 import tarfile ----> 3 from Six.moves import usrllib 4 5 # DOWNLOAD_ROOT = "https ://raw.githubusercontent.com/ageron/handson-ml2/master/"

ImportError:无法从“six.moves”(未知位置)导入名称“usrllib”

4

0 回答 0