Có một điều mà tôi không hiểu.Tại sao AttributeError này trong python xảy ra?
Tại sao thực hiện điều này
import scipy # happens with several other modules, too. I took scipy as an example now...
matrix = scipy.sparse.coo_matrix(some_params)
sản phẩm lỗi này:
AttributeError: 'module' object has no attribute 'sparse'
Điều gì khiến bạn khó chịu về điều đó? Bạn mong đợi điều gì sẽ xảy ra nếu 'sparse' không tồn tại trong module? –
Tôi đã không nhận ra rằng, thưa thớt là một * submodule * của scipy, và submodules là *** không ** nhập khẩu tự động * - như @ David Zaslavsky chỉ ra dưới đây. – Aufwind
downvoters nên giải thích lý do tại sao họ downvoted, tôi không thấy những gì sai với câu hỏi này. Trong thực tế, tôi nghĩ rằng đó là một câu hỏi rất hay – juliomalegria