Python3.10.6 无法 pip 安装东西:错误:子进程退出错误



在新的Ubuntu VPS上使用Python 3.10.6。无法安装dotenv, bs4等

使用pip 22.3.1版本。

为什么这个错误显示,我如何解决这个问题?我看了看其他问题,但都没能解决我的问题。我试过低点的版本,不成功。我甚至重新安装了python3.10。

谢谢。(在错误日志下面-一些发出,所有相关)

root@localhost:~/bp-scraper# pip3 install dotenv
Collecting dotenv
Using cached dotenv-0.0.5.tar.gz (2.4 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [64 lines of output]
/usr/local/lib/python3.10/dist-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [16 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 14, in <module>
from setuptools.command.install import install
File "/tmp/pip-wheel-pm4y5c7z/distribute_07cb0f8f57c049ab919d5b5646e56f
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
[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.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/setuptools/installer.py", line 82, in fetch_build_egg
subprocess.check_call(cmd)
File "/usr/lib/python3.10/subprocess.py", line 369, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpwdcseb1p', '--quiet', 'distribute']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 2, in <module>
return fetch_build_egg(self, req)
File "/usr/local/lib/python3.10/dist-packages/setuptools/installer.py", line 84, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpwdcseb1p', '--quiet', 'distribute']' returned non-zero exit status 1.
[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.

第一次更新setuptools,按照https://stackoverflow.com/a/58754136/5666087

pip install -U setuptools

然后为dotenv使用正确的软件包,即python-dotenv

pip install python-dotenv

最新更新