简体   繁体   English

安装工具不可用 - 安装 Python package 和 pip 时出错

[英]setuptools not available - error when installing Python package with pip

I'm trying to install the importlib package using pip3 , but I'm getting an error that says "Can not execute setup.py since setuptools is not available in the build environment."我正在尝试使用 pip3 安装importlib pip3 ,但我收到一条错误消息“无法执行 setup.py,因为 setuptools 在构建环境中不可用。” How can I fix this error and successfully install the importlib package?如何修复此错误并成功安装 importlib package?

mrichardsonr1@penguin:~$ pip3 install importlib
Defaulting to user installation because normal site-packages is not writeable
Collecting importlib
  Using cached importlib-1.0.4.zip (7.1 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      ERROR: Can not execute `setup.py` since setuptools is not available in the build environment.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I have uninstalled pip, setuptools, updated everything reinstalled everything, nothing works.我已经卸载了 pip、setuptools、更新了所有内容并重新安装了所有内容,但没有任何效果。 I am running this on Linux x86_64 container on ChromeOS.我在 ChromeOS 上的 Linux x86_64 容器上运行它。 I am using the latest version of setuptools which is what I was told could be causing this.我正在使用最新版本的setuptools ,有人告诉我这可能是导致此问题的原因。

mrichardsonr1@penguin:~$ pip3 install setuptools
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: setuptools in ./.local/lib/python3.9/site-packages (65.6.3)

As far as I know everything else is up to date.据我所知,其他一切都是最新的。 No clue why I am getting this error, and it's not just when installing this package I had the same issue trying to install the ping package.不知道为什么我会收到此错误,而且不仅仅是在安装此 package 时,我在尝试安装ping package 时遇到了同样的问题。

https://pypi.org/project/importlib/ https://pypi.org/project/importlib/

Installation package importlib is only for Python 2.7, you cannot install it with pip3 .安装 package importlib仅适用于 Python 2.7,不能使用pip3安装。

In Python 3 importlib became a package from the standard library: https://docs.python.org/3/library/importlib.html . Python 3 importlib从标准库变成了 package : https://docs.python.org/3/library/importlib.html You don't need to install it separately;您不需要单独安装它; once you've installed Python3 and the standard library the package is available for import.一旦安装了 Python3 和标准库,package 就可以导入了。 To check from the command line:从命令行检查:

$ python3 -c "import importlib"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM