尝试在 python 中安装 ant 模块并收到此错误

Posted

技术标签:

【中文标题】尝试在 python 中安装 ant 模块并收到此错误【英文标题】:Trying to install ant module in python and get this error 【发布时间】:2021-01-15 13:50:36 【问题描述】:

我正在尝试从命令行安装 ant 模块,但出现此错误:

C:\Users\97252>pip install ant

Collecting ant
Using cached ant-0.1.0.tar.gz (18 kB)
Collecting msgpack-python==0.1.10

Using cached msgpack-python-0.1.10.tar.gz (48 kB)
Collecting pyserial==2.5

Using cached pyserial-2.5.tar.gz (106 kB)

  WARNING: Generating metadata for package pyserial produced metadata for project name pyserial-py3k. Fix your #egg=pyserial fragments.

ERROR: Requested pyserial-py3k from https://files.pythonhosted.org/packages/c3/9c/9f97e7749c2373031e5dab6e47adab3eabbd5720615d98845ff8bad5b273/pyserial-2.5.tar.gz#sha256=eddd22280e0dac0888c6cddd8906ebd902fa42467fee151c43ecde4196bbf511 (from ant) has different name in metadata: 'pyserial-py3k'

当我尝试通过 pyCharm IDE 安装它时,我收到此错误:

Collecting ant
Using cached 

https://files.pythonhosted.org/packages/7e/9a/672711e3e9e264d7eee6048945f497d9fa9b311877f64fb74a7f297837da/ant-0.1.0.tar.gz

Collecting distribute (from ant)
 Using cached https://files.pythonhosted.org/packages/5f/ad/1fde06877a8d7d5c9b60eff7de2d452f639916ae1d48f0b8f97bf97e570a/distribute-0.7.3.zip

    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\97252\AppData\Local\Temp\pycharm-packaging\distribute\setuptools\__init__.py", line 2, in <module>
        from setuptools.extension import Extension, Library
      File "C:\Users\97252\AppData\Local\Temp\pycharm-packaging\distribute\setuptools\extension.py", line 5, in <module>
        from setuptools.dist import _get_unpatched
      File "C:\Users\97252\AppData\Local\Temp\pycharm-packaging\distribute\setuptools\dist.py", line 7, in <module>
        from setuptools.command.install import install
      File "C:\Users\97252\AppData\Local\Temp\pycharm-packaging\distribute\setuptools\command\__init__.py", line 8, in <module>
        from setuptools.command import install_scripts
      File "C:\Users\97252\AppData\Local\Temp\pycharm-packaging\distribute\setuptools\command\install_scripts.py", line 3, in <module>
        from pkg_resources import Distribution, PathMetadata, ensure_directory
      File "C:\Users\97252\AppData\Local\Temp\pycharm-packaging\distribute\pkg_resources.py", line 1518, in <module>
        register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
    AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\97252\AppData\Local\Temp\pycharm-packaging\distribute\

请帮帮我。

【问题讨论】:

【参考方案1】:

您需要通过输入以下命令升级您的setuptools

pip install --upgrade setuptools

【讨论】:

已经设置好了。已满足要求:c:\users\97252\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (51.1.2) 中的 setuptools @MatanRan 你升级了吗? 是的,我确实升级了它们。当我再次尝试重新安装“ant”模块时,它显示相同的错误。 @MatanRan 尝试超级用户sudo pip install --upgrade setuptools 我用的是windows

以上是关于尝试在 python 中安装 ant 模块并收到此错误的主要内容,如果未能解决你的问题,请参考以下文章

即使使用python在系统中安装了robotframework,也会收到错误“来自robot import run_cli ImportError:没有名为robot的模块”?

在python 3.5中安装senticnet

如何在 linux ubuntu 中安装 python3 线程模块

在 nitrousio 中安装 python 包

在 Rstudio 中安装 Python 模块

在 python 2.7 windows 中安装请求模块