我在尝试安装 dm-sonnet 软件包时遇到 python-2.7 中的 "from setuptools import find_namespace_packages" 错误。任何可能的解决方案?

I am facing "from setuptools import find_namespace_packages" error in python-2.7 while trying to install dm-sonnet package. Any possible solution?

我需要为某些脚本使用 python-2.7,setuptools==39.1.0,我无法 pip install dm-sonnet,setuptools 中应该有 find_namespace_packages 吗?它不在这个 setuptools(或 v44)中 错误信息:

ERROR: Command errored out with exit status 1:
         command: /home/russo/anaconda3/envs/russo2/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-9l072x/dm-sonnet/setup.py'"'"'; __file__='"'"'/tmp/pip-install-9l072x/dm-sonnet/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-9l072x/dm-sonnet/pip-egg-info
             cwd: /tmp/pip-install-9l072x/dm-sonnet/
        Complete output (5 lines):
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/tmp/pip-install-9l072x/dm-sonnet/setup.py", line 7, in <module>
            from setuptools import find_namespace_packages
        ImportError: cannot import name find_namespace_packages
        ----------------------------------------
    ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

dm-sonnet requires Python 3。您不能将它与 Python 一起使用 2.

00612ca setup.py uses find_packages. You can try this version with Python 2.7. It's perhaps release 1.36 或更早的提交中。尝试

pip2 install dm-sonnet==1.36

pip2 install 'dm-sonnet<2'