[英]Python 3.10 deprecation warning for distutils
DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
from distutils.dir_util import copy_tree
這是我應該擔心的事情嗎? 我應該使用哪個導入來替換from distutils.dir_util import copy_tree
行?
更改自:
from distutils.dir_util import copy_tree
copy_tree(loc_source, loc_destination)
至:
import shutil
shutil.copytree(loc_source, loc_destination)
或者,要替換現有文件和文件夾:
import shutil
shutil.copytree(loc_source, loc_destination, dirs_exist_ok=True)
文檔: https://docs.python.org/3/library/shutil.html#shutil.copytree
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.