1006:A+B问题

本文详细解析了常见的A+B问题,介绍了其在在线题库中的作用,并提供了C++语言的解答代码示例。适合编程初学者快速上手。

1006:A+B问题

题目

时间限制: 1000 ms 内存限制: 66536 KB
提交数: 29589 通过数: 22574
【题目描述】
大部分的在线题库,都会将A+B问题作为第一题,以帮助新手熟悉平台的使用方法。

A+B问题的题目描述如下:给定两个整数A和B,输出A+B的值。保证A、B及结果均在整型范围内。现在请你解决这一问题。

【输入】
一行,包含两个整数A,B,中间用单个空格隔开。A和B均在整型范围内。

【输出】
一个整数,即A+B的值。保证结果在整型范围内。

【输入样例】
1 2
【输出样例】
3
【来源】

No

解答

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	cout<<a+b;
	return 0;
}

小编插一嘴

请问欧们4不4阔以造操1000,这个题库的作者脑子貌似XX(jin shui)了

PS C:\Users\Administrator\Desktop> # ===== 重构插件安装函数 ===== PS C:\Users\Administrator\Desktop> function Install-PthFixPlugin { >> param( >> [string]$PythonPath = "E:\Python310" >> ) >> >> $sitePackages = "$PythonPath\Lib\site-packages" >> $pluginRoot = "$sitePackages\pth_fix_plugin" >> >> # 创建插件目录结构 >> $packageDir = "$pluginRoot\pth_fix_plugin" >> New-Item -ItemType Directory -Path $packageDir -Force | Out-Null >> >> # 创建插件内容 >> $pluginFile = "$packageDir\__init__.py" >> @" >> # pth_fix_plugin/__init__.py >> import os >> import sys >> import logging >> from setuptools import setup >> from setuptools.command.install import install >> >> logger = logging.getLogger(__name__) >> >> class CustomInstallCommand(install): >> """自定义安装命令,阻止生成distutils-precedence.pth文件""" >> >> def run(self): >> # 调用原始安装方法 >> install.run(self) >> >> # 修复.pth文件 >> self.fix_pth_file() >> >> def fix_pth_file(self): >> """修复.pth文件问题""" >> pth_path = os.path.join(self.install_lib, 'distutils-precedence.pth') >> >> if os.path.exists(pth_path): >> logger.info(f"🔧 删除有问题的.pth文件: {pth_path}") >> try: >> os.remove(pth_path) >> logger.info("✅ 成功删除.pth文件") >> except Exception as e: >> logger.error(f"❌ 删除.pth文件失败: {str(e)}") >> else: >> logger.info("✅ 未发现.pth文件,无需修复") >> >> # 注册自定义命令 >> try: >> setup.commands['install'] = CustomInstallCommand >> logger.info("✅ 成功注册pth_fix插件") >> except Exception as e: >> logger.error(f"❌ 注册插件失败: {str(e)}") >> "@ | Set-Content -Path $pluginFile -Force >> >> # 创建入口点配置 >> $setupFile = "$pluginRoot\setup.py" >> @" >> from setuptools import setup >> >> setup( >> name='pth_fix_plugin', >> version='1.0.0', >> packages=['pth_fix_plugin'], >> entry_points={ >> 'distutils.commands': [ >> 'install = pth_fix_plugin:CustomInstallCommand', >> ], >> }, >> ) >> "@ | Set-Content -Path $setupFile -Force >> >> # 安装插件 >> Push-Location -Path $pluginRoot >> python -m pip install --no-deps -e . --no-warn-script-location >> Pop-Location >> >> Write-Host "✅ pth_fix插件安装完成" -ForegroundColor Green >> } PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # ===== 更新验证函数 ===== PS C:\Users\Administrator\Desktop> function Test-FullEnvironment { >> param( >> [string]$PythonPath = "E:\Python310" >> ) >> >> # 验证核心组件 >> python -c "import torch, torchvision, torchaudio, numpy as np, modelscope; print(f'PyTorch: {torch.__version__}\nTorchVision: {torchvision.__version__}\nTorchAudio: {torchaudio.__version__}\nNumPy: {np.__version__}\nAudio Backend: {torchaudio.get_audio_backend()}\nModelScope: {modelscope.__version__}')" >> >> # 验证警告 >> python -c "import warnings; warnings.filterwarnings('error'); import modelscope" 2>&1 | Out-Null >> if ($LASTEXITCODE -eq 0) { >> Write-Host "✅ 环境无警告" -ForegroundColor Green >> } else { >> Write-Host "❌ 环境存在警告" -ForegroundColor Red >> } >> >> # 验证.pth文件 >> $sitePackages = "$PythonPath\Lib\site-packages" >> if (Test-Path $sitePackages) { >> $pthFiles = Get-ChildItem $sitePackages -Filter "distutils-precedence.pth" -ErrorAction SilentlyContinue >> >> if ($pthFiles) { >> Write-Host "⚠️ 发现.pth文件: $($pthFiles.FullName)" -ForegroundColor Yellow >> } else { >> Write-Host "✅ 未发现distutils-precedence.pth文件" -ForegroundColor Green >> } >> >> # 验证插件状态 >> python -c "import sys; from pkg_resources import iter_entry_points; >> entry_points = list(iter_entry_points('distutils.commands', 'install')); >> if entry_points: >> print('✅ 安装命令挂钩:', entry_points[0].module_name) >> else: >> print('❌ 安装命令未挂钩')" >> } else { >> Write-Host "❌ 路径不存在: $sitePackages" -ForegroundColor Red >> } >> } PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # ===== 执行最终修复 ===== PS C:\Users\Administrator\Desktop> # 1. 确保插件目录完全删除 PS C:\Users\Administrator\Desktop> $pluginPath = "E:\Python310\Lib\site-packages\pth_fix_plugin" PS C:\Users\Administrator\Desktop> if (Test-Path $pluginPath) { >> Remove-Item -Path $pluginPath -Recurse -Force >> Write-Host "🔧 删除旧插件目录: $pluginPath" -ForegroundColor Cyan >> } 🔧 删除旧插件目录: E:\Python310\Lib\site-packages\pth_fix_plugin PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # 2. 重新安装插件 PS C:\Users\Administrator\Desktop> Install-PthFixPlugin -PythonPath "E:\Python310" Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Obtaining file:///E:/Python310/Lib/site-packages/pth_fix_plugin Preparing metadata (setup.py) ... done Installing collected packages: pth_fix_plugin DEPRECATION: Legacy editable install of pth_fix_plugin==1.0.0 from file:///E:/Python310/Lib/site-packages/pth_fix_plugin (setup.py develop) is deprecated. pip 25.3 will enforce this behaviour change. A possible replacement is to add a pyproject.toml or enable --use-pep517, and use setuptools >= 64. If the resulting installation is not behaving as expected, try using --config-settings editable_mode=compat. Please consult the setuptools documentation for more information. Discussion can be found at https://github.com/pypa/pip/issues/11457 Running setup.py develop for pth_fix_plugin error: subprocess-exited-with-error × python setup.py develop did not run successfully. │ exit code: 1 ╰─> [136 lines of output] running develop E:\Python310\lib\site-packages\setuptools\_distutils\cmd.py:90: DevelopDeprecationWarning: develop command is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` and ``develop``. Instead, use standards-based tools like pip or uv. By 2025-Oct-31, you need to update your project and remove deprecated calls or your builds will no longer be supported. See https://github.com/pypa/setuptools/issues/917 for details. ******************************************************************************** !! self.initialize_options() Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Obtaining file:///E:/Python310/Lib/site-packages/pth_fix_plugin Installing build dependencies: started Installing build dependencies: finished with status 'done' Checking if build backend supports build_editable: started Checking if build backend supports build_editable: finished with status 'done' Getting requirements to build editable: started Getting requirements to build editable: finished with status 'done' Preparing editable metadata (pyproject.toml): started Preparing editable metadata (pyproject.toml): finished with status 'done' Building wheels for collected packages: pth_fix_plugin Building editable for pth_fix_plugin (pyproject.toml): started Building editable for pth_fix_plugin (pyproject.toml): finished with status 'error' error: subprocess-exited-with-error Building editable for pth_fix_plugin (pyproject.toml) did not run successfully. exit code: 1 [69 lines of output] running editable_wheel creating C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info writing C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\PKG-INFO writing dependency_links to C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\dependency_links.txt writing entry points to C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\entry_points.txt writing top-level names to C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\top_level.txt writing manifest file 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\SOURCES.txt' reading manifest file 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\SOURCES.txt' writing manifest file 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\SOURCES.txt' creating 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin-1.0.0.dist-info' creating C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin-1.0.0.dist-info\WHEEL Traceback (most recent call last): File "E:\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module> main() File "E:\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) File "E:\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 303, in build_editable return hook(wheel_directory, config_settings, metadata_directory) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\build_meta.py", line 468, in build_editable return self._build_with_temp_dir( File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\build_meta.py", line 404, in _build_with_temp_dir self.run_setup() File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup exec(code, locals()) File "<string>", line 3, in <module> File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\__init__.py", line 115, in setup return distutils.core.setup(**attrs) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 186, in setup return run_commands(dist) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 202, in run_commands dist.run_commands() File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_commands self.run_command(cmd) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 139, in run self._create_wheel_file(bdist_wheel) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 349, in _create_wheel_file files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 271, in _run_build_commands self._configure_build(dist_name, unpacked_wheel, build_lib, tmp_dir) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 209, in _configure_build install_cls, dist.reinitialize_command("install", reinit_subcommands=True) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 974, in reinitialize_command command = self.get_command_obj(command_name) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 884, in get_command_obj klass = self.get_command_class(command) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\dist.py", line 846, in get_command_class self.cmdclass[command] = cmdclass = ep.load() File "E:\Python310\lib\importlib\metadata\__init__.py", line 171, in load module = import_module(match.group('module')) File "E:\Python310\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 879, in exec_module File "<frozen importlib._bootstrap_external>", line 1017, in get_code File "<frozen importlib._bootstrap_external>", line 947, in source_to_code File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "E:\Python310\Lib\site-packages\pth_fix_plugin\pth_fix_plugin\__init__.py", line 11 """\ufffd\u0536\ufffd\ufffd尲\u05f0\ufffd\ufffd\ufffd\ue8ec\ufffd\ufffd\u05b9\ufffd\ufffd\ufffd\ufffddistutils-precedence.pth\ufffd\u013c\ufffd""" ^ SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xd7 in position 0: invalid continuation byte [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building editable for pth_fix_plugin Failed to build pth_fix_plugin error: failed-wheel-build-for-install Failed to build installable wheels for some pyproject.toml based projects pth_fix_plugin Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 35, in <module> File "E:\Python310\Lib\site-packages\pth_fix_plugin\setup.py", line 3, in <module> setup( File "E:\Python310\lib\site-packages\setuptools\__init__.py", line 115, in setup return distutils.core.setup(**attrs) File "E:\Python310\lib\site-packages\setuptools\_distutils\core.py", line 186, in setup return run_commands(dist) File "E:\Python310\lib\site-packages\setuptools\_distutils\core.py", line 202, in run_commands dist.run_commands() File "E:\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_commands self.run_command(cmd) File "E:\Python310\lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) File "E:\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() File "E:\Python310\lib\site-packages\setuptools\command\develop.py", line 39, in run subprocess.check_call(cmd) File "E:\Python310\lib\subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['E:\\Python310\\python.exe', '-m', 'pip', 'install', '-e', '.', '--use-pep517', '--no-deps']' 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: subprocess-exited-with-error × python setup.py develop did not run successfully. │ exit code: 1 ╰─> [136 lines of output] running develop E:\Python310\lib\site-packages\setuptools\_distutils\cmd.py:90: DevelopDeprecationWarning: develop command is deprecated. !! ******************************************************************************** Please avoid running ``setup.py`` and ``develop``. Instead, use standards-based tools like pip or uv. By 2025-Oct-31, you need to update your project and remove deprecated calls or your builds will no longer be supported. See https://github.com/pypa/setuptools/issues/917 for details. ******************************************************************************** !! self.initialize_options() Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Obtaining file:///E:/Python310/Lib/site-packages/pth_fix_plugin Installing build dependencies: started Installing build dependencies: finished with status 'done' Checking if build backend supports build_editable: started Checking if build backend supports build_editable: finished with status 'done' Getting requirements to build editable: started Getting requirements to build editable: finished with status 'done' Preparing editable metadata (pyproject.toml): started Preparing editable metadata (pyproject.toml): finished with status 'done' Building wheels for collected packages: pth_fix_plugin Building editable for pth_fix_plugin (pyproject.toml): started Building editable for pth_fix_plugin (pyproject.toml): finished with status 'error' error: subprocess-exited-with-error Building editable for pth_fix_plugin (pyproject.toml) did not run successfully. exit code: 1 [69 lines of output] running editable_wheel creating C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info writing C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\PKG-INFO writing dependency_links to C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\dependency_links.txt writing entry points to C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\entry_points.txt writing top-level names to C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\top_level.txt writing manifest file 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\SOURCES.txt' reading manifest file 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\SOURCES.txt' writing manifest file 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin.egg-info\SOURCES.txt' creating 'C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin-1.0.0.dist-info' creating C:\Users\Administrator\AppData\Local\Temp\pip-wheel-t28f3jf3\.tmp-zcv0fbtc\pth_fix_plugin-1.0.0.dist-info\WHEEL Traceback (most recent call last): File "E:\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module> main() File "E:\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) File "E:\Python310\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 303, in build_editable return hook(wheel_directory, config_settings, metadata_directory) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\build_meta.py", line 468, in build_editable return self._build_with_temp_dir( File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\build_meta.py", line 404, in _build_with_temp_dir self.run_setup() File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup exec(code, locals()) File "<string>", line 3, in <module> File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\__init__.py", line 115, in setup return distutils.core.setup(**attrs) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 186, in setup return run_commands(dist) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 202, in run_commands dist.run_commands() File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_commands self.run_command(cmd) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 139, in run self._create_wheel_file(bdist_wheel) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 349, in _create_wheel_file files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 271, in _run_build_commands self._configure_build(dist_name, unpacked_wheel, build_lib, tmp_dir) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 209, in _configure_build install_cls, dist.reinitialize_command("install", reinit_subcommands=True) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 974, in reinitialize_command command = self.get_command_obj(command_name) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 884, in get_command_obj klass = self.get_command_class(command) File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-it_isus5\overlay\Lib\site-packages\setuptools\dist.py", line 846, in get_command_class self.cmdclass[command] = cmdclass = ep.load() File "E:\Python310\lib\importlib\metadata\__init__.py", line 171, in load module = import_module(match.group('module')) File "E:\Python310\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1050, in _gcd_import File "<frozen importlib._bootstrap>", line 1027, in _find_and_load File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 688, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 879, in exec_module File "<frozen importlib._bootstrap_external>", line 1017, in get_code File "<frozen importlib._bootstrap_external>", line 947, in source_to_code File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "E:\Python310\Lib\site-packages\pth_fix_plugin\pth_fix_plugin\__init__.py", line 11 """\ufffd\u0536\ufffd\ufffd尲\u05f0\ufffd\ufffd\ufffd\ue8ec\ufffd\ufffd\u05b9\ufffd\ufffd\ufffd\ufffddistutils-precedence.pth\ufffd\u013c\ufffd""" ^ SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xd7 in position 0: invalid continuation byte [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building editable for pth_fix_plugin Failed to build pth_fix_plugin error: failed-wheel-build-for-install Failed to build installable wheels for some pyproject.toml based projects pth_fix_plugin Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 35, in <module> File "E:\Python310\Lib\site-packages\pth_fix_plugin\setup.py", line 3, in <module> setup( File "E:\Python310\lib\site-packages\setuptools\__init__.py", line 115, in setup return distutils.core.setup(**attrs) File "E:\Python310\lib\site-packages\setuptools\_distutils\core.py", line 186, in setup return run_commands(dist) File "E:\Python310\lib\site-packages\setuptools\_distutils\core.py", line 202, in run_commands dist.run_commands() File "E:\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_commands self.run_command(cmd) File "E:\Python310\lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) File "E:\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() File "E:\Python310\lib\site-packages\setuptools\command\develop.py", line 39, in run subprocess.check_call(cmd) File "E:\Python310\lib\subprocess.py", line 369, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['E:\\Python310\\python.exe', '-m', 'pip', 'install', '-e', '.', '--use-pep517', '--no-deps']' returned non-zero exit status 1. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ✅ pth_fix插件安装完成 PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # 3. 验证环境 PS C:\Users\Administrator\Desktop> Test-FullEnvironment -PythonPath "E:\Python310" PyTorch: 2.0.0+cpu TorchVision: 0.15.1+cpu TorchAudio: 2.0.1+cpu NumPy: 1.26.4 Audio Backend: soundfile ModelScope: 1.29.0 ✅ 环境无警告 ⚠️ 发现.pth文件: E:\Python310\Lib\site-packages\distutils-precedence.pth <string>:1: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. ✅ 安装命令挂钩: setuptools.command.install PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # 4. 测试修复持久性 PS C:\Users\Administrator\Desktop> python -m pip install --upgrade setuptools --force-reinstall Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting setuptools Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a3/dc/17031897dae0efacfea57dfd3a82fdd2a2aeb58e0ff71b77b87e44edc772/setuptools-80.9.0-py3-none-any.whl (1.2 MB) Installing collected packages: setuptools Attempting uninstall: setuptools Found existing installation: setuptools 80.9.0 Uninstalling setuptools-80.9.0: Successfully uninstalled setuptools-80.9.0 Successfully installed setuptools-80.9.0 PS C:\Users\Administrator\Desktop> Test-FullEnvironment -PythonPath "E:\Python310" PyTorch: 2.0.0+cpu TorchVision: 0.15.1+cpu TorchAudio: 2.0.1+cpu NumPy: 1.26.4 Audio Backend: soundfile ModelScope: 1.29.0 ✅ 环境无警告 ⚠️ 发现.pth文件: E:\Python310\Lib\site-packages\distutils-precedence.pth <string>:1: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81. ✅ 安装命令挂钩: setuptools.command.install PS C:\Users\Administrator\Desktop> # 清理旧插件 PS C:\Users\Administrator\Desktop> 🔧 删除旧插件目录: E:\Python310\Lib\site-packages\pth_fix_plugin 🔧 : 无法将“🔧”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然 后再试一次。 所在位置 行:1 字符: 1 + 🔧 删除旧插件目录: E:\Python310\Lib\site-packages\pth_fix_plugin + ~~ + CategoryInfo : ObjectNotFound: (🔧:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # 安装新插件 PS C:\Users\Administrator\Desktop> ✅ pth_fix插件安装完成 ✅ : 无法将“✅”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后 再试一次。 所在位置 行:1 字符: 1 + ✅ pth_fix插件安装完成 + ~ + CategoryInfo : ObjectNotFound: (✅:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # 验证环境 PS C:\Users\Administrator\Desktop> PyTorch: 2.0.0+cpu PyTorch: : 无法将“PyTorch:”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保 路径正确,然后再试一次。 所在位置 行:1 字符: 1 + PyTorch: 2.0.0+cpu + ~~~~~~~~ + CategoryInfo : ObjectNotFound: (PyTorch::String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> TorchVision: 0.15.1+cpu TorchVision: : 无法将“TorchVision:”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径 ,请确保路径正确,然后再试一次。 所在位置 行:1 字符: 1 + TorchVision: 0.15.1+cpu + ~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (TorchVision::String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> TorchAudio: 2.0.1+cpu TorchAudio: : 无法将“TorchAudio:”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径, 请确保路径正确,然后再试一次。 所在位置 行:1 字符: 1 + TorchAudio: 2.0.1+cpu + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (TorchAudio::String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> NumPy: 1.26.4 NumPy: : 无法将“NumPy:”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径 正确,然后再试一次。 所在位置 行:1 字符: 1 + NumPy: 1.26.4 + ~~~~~~ + CategoryInfo : ObjectNotFound: (NumPy::String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> Audio Backend: soundfile Audio : 无法将“Audio”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正 确,然后再试一次。 所在位置 行:1 字符: 1 + Audio Backend: soundfile + ~~~~~ + CategoryInfo : ObjectNotFound: (Audio:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> ModelScope: 1.29.0 ModelScope: : 无法将“ModelScope:”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径, 请确保路径正确,然后再试一次。 所在位置 行:1 字符: 1 + ModelScope: 1.29.0 + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (ModelScope::String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> ✅ 环境无警告 ✅ : 无法将“✅”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后 再试一次。 所在位置 行:1 字符: 1 + ✅ 环境无警告 + ~ + CategoryInfo : ObjectNotFound: (✅:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> ✅ 未发现distutils-precedence.pth文件 ✅ : 无法将“✅”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后 再试一次。 所在位置 行:1 字符: 1 + ✅ 未发现distutils-precedence.pth文件 + ~ + CategoryInfo : ObjectNotFound: (✅:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> ✅ 安装命令挂钩: pth_fix_plugin ✅ : 无法将“✅”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后 再试一次。 所在位置 行:1 字符: 1 + ✅ 安装命令挂钩: pth_fix_plugin + ~ + CategoryInfo : ObjectNotFound: (✅:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> PS C:\Users\Administrator\Desktop> # 测试持久性 PS C:\Users\Administrator\Desktop> Successfully installed setuptools-80.9.0 Successfully : 无法将“Successfully”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径 ,请确保路径正确,然后再试一次。 所在位置 行:1 字符: 1 + Successfully installed setuptools-80.9.0 + ~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Successfully:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> PyTorch: 2.0.0+cpu PyTorch: : 无法将“PyTorch:”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保 路径正确,然后再试一次。 所在位置 行:1 字符: 1 + PyTorch: 2.0.0+cpu + ~~~~~~~~ + CategoryInfo : ObjectNotFound: (PyTorch::String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> TorchVision: 0.15.1+cpu TorchVision: : 无法将“TorchVision:”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径 ,请确保路径正确,然后再试一次。 所在位置 行:1 字符: 1 + TorchVision: 0.15.1+cpu + ~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (TorchVision::String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> TorchAudio: 2.0.1+cpu TorchAudio: : 无法将“TorchAudio:”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径, 请确保路径正确,然后再试一次。 所在位置 行:1 字符: 1 + TorchAudio: 2.0.1+cpu + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (TorchAudio::String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> NumPy: 1.26.4 NumPy: : 无法将“NumPy:”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径 正确,然后再试一次。 所在位置 行:1 字符: 1 + NumPy: 1.26.4 + ~~~~~~ + CategoryInfo : ObjectNotFound: (NumPy::String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> Audio Backend: soundfile Audio : 无法将“Audio”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正 确,然后再试一次。 所在位置 行:1 字符: 1 + Audio Backend: soundfile + ~~~~~ + CategoryInfo : ObjectNotFound: (Audio:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> ModelScope: 1.29.0 ModelScope: : 无法将“ModelScope:”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径, 请确保路径正确,然后再试一次。 所在位置 行:1 字符: 1 + ModelScope: 1.29.0 + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (ModelScope::String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> ✅ 环境无警告 ✅ : 无法将“✅”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后 再试一次。 所在位置 行:1 字符: 1 + ✅ 环境无警告 + ~ + CategoryInfo : ObjectNotFound: (✅:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> ✅ 未发现distutils-precedence.pth文件 ✅ : 无法将“✅”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后 再试一次。 所在位置 行:1 字符: 1 + ✅ 未发现distutils-precedence.pth文件 + ~ + CategoryInfo : ObjectNotFound: (✅:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop> ✅ 安装命令挂钩: pth_fix_plugin ✅ : 无法将“✅”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后 再试一次。 所在位置 行:1 字符: 1 + ✅ 安装命令挂钩: pth_fix_plugin + ~ + CategoryInfo : ObjectNotFound: (✅:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException PS C:\Users\Administrator\Desktop>
最新发布
08-23
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值