ImportError: cannot import name 'Feature' from 'setuptools' (D:\python_learn\meiduo_project\env\lib\site-packages\setuptools\__init__.py)问题

查询后发现是,因MarkupSafe==1.0 版本较低, 其引用Feature的方式from setuptools import Feature在新版本的setuptools包中已被弃用,
所以导致了上文出现的bug。
那解决思路就清晰了,如下思路取一即可。

    1. 升级 MarkupSafe==1.1.1
    2. 降级 setuptools==45.2.0

报错:

Collecting MarkupSafe==1.0
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/4d/de/32d741db316d8fdb7680822dd37001ef7a448255de9699ab4bfcbdf4172b/MarkupSafe-1.0.tar.gz (14 kB)
    ERROR: Command errored out with exit status 1:
     command: 'D:\python_learn\meiduo_project\env\Scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\sewen\\AppData\\Local\\Temp\\pip-install-8mqd0f
cd\\MarkupSafe\\setup.py'"'"'; __file__='"'"'C:\\Users\\sewen\\AppData\\Local\\Temp\\pip-install-8mqd0fcd\\MarkupSafe\\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 'C:\Users\sewen\AppData\Local\Temp\pip-pip-egg-info-h2xw
dl2l'
         cwd: C:\Users\sewen\AppData\Local\Temp\pip-install-8mqd0fcd\MarkupSafe\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\sewen\AppData\Local\Temp\pip-install-8mqd0fcd\MarkupSafe\setup.py", line 6, in <module>
        from setuptools import setup, Extension, Feature
    ImportError: cannot import name 'Feature' from 'setuptools' (D:\python_learn\meiduo_project\env\lib\site-packages\setuptools\__init__.py)
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

 

执行:

pip install --upgrade pip setuptools==45.2.0

如下:

 

正常安装 问题解决.

 

posted @ 2020-08-06 16:37  sewen  Views(1904)  Comments(0Edit  收藏  举报