安装pip3时virtualenvwrapper出错怎么办?

2026-06-09 09:403阅读0评论SEO资讯
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计1027个文字,预计阅读时间需要5分钟。

安装pip3时virtualenvwrapper出错怎么办?

[root@python01 ~]# 创建一个新的Python脚本,命名为`script.py`,并添加以下内容:

python导入所需的库import os

定义一个函数来检查文件是否存在def file_exists(filename): return os.path.exists(filename)

定义一个函数来读取文件内容def read_file_content(filename): with open(filename, 'r') as file: content=file.read() return content

主程序if __name__==__main__: # 检查输入文件是否存在 if file_exists(input.txt): # 读取文件内容 content=read_file_content(input.txt) # 打印文件内容 print(content) else: print(输入文件不存在)

[root@python01 ~]# 保存并退出编辑器。

[root@python01 ~]# 运行脚本:

bash[root@python01 ~]# python script.py

安装pip3时virtualenvwrapper出错怎么办?

如果`input.txt`文件存在,脚本将打印其内容;如果不存在,将输出输入文件不存在。

[root@python01 ~]# pip3 install virtualenvwrapper
Looking in indexes: mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting virtualenvwrapper
Using cached mirrors.cloud.aliyuncs.com/pypi/packages/c1/6b/2f05d73b2d2f2410b48b90d3783a0034c26afa534a4a95ad5f1178d61191/virtualenvwrapper-4.8.4.tar.gz (334 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [45 lines of output]
/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py:767: UserWarning: Usage of dash-separated 'index-url' will not be supported in future versions. Please use the underscore name 'index_url' instead
warnings.warn(
/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py:767: UserWarning: Usage of dash-separated 'author-email' will not be supported in future versions. Please use the underscore name 'author_email' instead
warnings.warn(
/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py:767: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py:767: UserWarning: Usage of dash-separated 'home-page' will not be supported in future versions. Please use the underscore name 'home_page' instead
warnings.warn(
/usr/local/python3/lib/python3.9/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
WARNING: The wheel package is not available.
WARNING: The repository located at mirrors.cloud.aliyuncs.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.cloud.aliyuncs.com'.
ERROR: Could not find a version that satisfies the requirement pbr (from versions: none)
ERROR: No matching distribution found for pbr
Traceback (most recent call last):
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
subprocess.check_call(cmd)
File "/usr/local/python3/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/python3/bin/python3.9', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp66d9r5_6', '--quiet', '--index-url', 'mirrors.cloud.aliyuncs.com/pypi/simple/', 'pbr']' 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>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-5lfzgb_g/virtualenvwrapper_41d0686999e34962b4cca9a3751db153/setup.py", line 5, in <module>
setup(
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/__init__.py", line 86, in setup
_install_setup_requires(attrs)
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/__init__.py", line 80, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py", line 871, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "/usr/local/python3/lib/python3.9/site-packages/pkg_resources/__init__.py", line 789, in resolve
dist = best[req.key] = env.best_match(
File "/usr/local/python3/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1075, in best_match
return self.obtain(req, installer)
File "/usr/local/python3/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1087, in obtain
return installer(requirement)
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py", line 951, in fetch_build_egg
return fetch_build_egg(self, req)
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/local/python3/bin/python3.9', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp66d9r5_6', '--quiet', '--index-url', 'mirrors.cloud.aliyuncs.com/pypi/simple/', 'pbr']' 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.

找了好久,都没解决到底是什么问题导致报错,发现:

ERROR: Could not find a version that satisfies the requirement pbr (from versions: none)

ERROR: No matching distribution found for pbr

说没有找到pbr,干脆就pip3 install pbr装上,然后问题就解决了.........

本文共计1027个文字,预计阅读时间需要5分钟。

安装pip3时virtualenvwrapper出错怎么办?

[root@python01 ~]# 创建一个新的Python脚本,命名为`script.py`,并添加以下内容:

python导入所需的库import os

定义一个函数来检查文件是否存在def file_exists(filename): return os.path.exists(filename)

定义一个函数来读取文件内容def read_file_content(filename): with open(filename, 'r') as file: content=file.read() return content

主程序if __name__==__main__: # 检查输入文件是否存在 if file_exists(input.txt): # 读取文件内容 content=read_file_content(input.txt) # 打印文件内容 print(content) else: print(输入文件不存在)

[root@python01 ~]# 保存并退出编辑器。

[root@python01 ~]# 运行脚本:

bash[root@python01 ~]# python script.py

安装pip3时virtualenvwrapper出错怎么办?

如果`input.txt`文件存在,脚本将打印其内容;如果不存在,将输出输入文件不存在。

[root@python01 ~]# pip3 install virtualenvwrapper
Looking in indexes: mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting virtualenvwrapper
Using cached mirrors.cloud.aliyuncs.com/pypi/packages/c1/6b/2f05d73b2d2f2410b48b90d3783a0034c26afa534a4a95ad5f1178d61191/virtualenvwrapper-4.8.4.tar.gz (334 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [45 lines of output]
/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py:767: UserWarning: Usage of dash-separated 'index-url' will not be supported in future versions. Please use the underscore name 'index_url' instead
warnings.warn(
/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py:767: UserWarning: Usage of dash-separated 'author-email' will not be supported in future versions. Please use the underscore name 'author_email' instead
warnings.warn(
/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py:767: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
warnings.warn(
/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py:767: UserWarning: Usage of dash-separated 'home-page' will not be supported in future versions. Please use the underscore name 'home_page' instead
warnings.warn(
/usr/local/python3/lib/python3.9/site-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer.
warnings.warn(
WARNING: The wheel package is not available.
WARNING: The repository located at mirrors.cloud.aliyuncs.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.cloud.aliyuncs.com'.
ERROR: Could not find a version that satisfies the requirement pbr (from versions: none)
ERROR: No matching distribution found for pbr
Traceback (most recent call last):
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/installer.py", line 82, in fetch_build_egg
subprocess.check_call(cmd)
File "/usr/local/python3/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/local/python3/bin/python3.9', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp66d9r5_6', '--quiet', '--index-url', 'mirrors.cloud.aliyuncs.com/pypi/simple/', 'pbr']' 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>
File "<pip-setuptools-caller>", line 34, in <module>
File "/tmp/pip-install-5lfzgb_g/virtualenvwrapper_41d0686999e34962b4cca9a3751db153/setup.py", line 5, in <module>
setup(
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/__init__.py", line 86, in setup
_install_setup_requires(attrs)
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/__init__.py", line 80, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py", line 871, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "/usr/local/python3/lib/python3.9/site-packages/pkg_resources/__init__.py", line 789, in resolve
dist = best[req.key] = env.best_match(
File "/usr/local/python3/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1075, in best_match
return self.obtain(req, installer)
File "/usr/local/python3/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1087, in obtain
return installer(requirement)
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/dist.py", line 951, in fetch_build_egg
return fetch_build_egg(self, req)
File "/usr/local/python3/lib/python3.9/site-packages/setuptools/installer.py", line 84, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['/usr/local/python3/bin/python3.9', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmp66d9r5_6', '--quiet', '--index-url', 'mirrors.cloud.aliyuncs.com/pypi/simple/', 'pbr']' 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.

找了好久,都没解决到底是什么问题导致报错,发现:

ERROR: Could not find a version that satisfies the requirement pbr (from versions: none)

ERROR: No matching distribution found for pbr

说没有找到pbr,干脆就pip3 install pbr装上,然后问题就解决了.........