小编the*_*tar的帖子

Python 无法从“setuptools”包导入名称“find_namespace_packages”

我目前正在创建一个 python 库,需要使用“setuptools”包中的“find_namespace_packages”。然而,python 每当运行时都会抛出以下 ImportError 消息:

ImportError: cannot import name 'find_namespace_packages' from 'setuptools'
Run Code Online (Sandbox Code Playgroud)

然而,从“setuptools”导入其他功能(如“setup”和“find_packages”)没有问题。

我该如何排除故障?

我已经多次卸载并重新安装“setuptools”并更新了 Spyder 和 Anaconda。

这也是我的代码示例:

from setuptools import setup, find_namespace_packages

setup(

      name="sample",

      version="0.0.1",

      packages=find_namespace_packages()

      )
Run Code Online (Sandbox Code Playgroud)

我目前使用的是 Python 3.7.5,setuptools 版本为 49.6.0

python setuptools python-import importerror

5
推荐指数
1
解决办法
9911
查看次数

标签 统计

importerror ×1

python ×1

python-import ×1

setuptools ×1