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 sysconfig
>> import traceback
>> import shutil
>> import atexit
>> from setuptools.command.install import install
>>
>> class CustomInstallCommand(install):
>> """Custom install command to prevent .pth file generation"""
>>
>> def run(self):
>> # 调用原始安装方法
>> install.run(self)
>>
>> # 修复.pth文件
>> self.fix_pth_file()
>>
>> def fix_pth_file(self):
>> """Fix the .pth file issue with enhanced logic"""
>> try:
>> # 获取所有可能的site-packages路径
>> possible_paths = [
>> sysconfig.get_paths()["purelib"],
>> sysconfig.get_paths()["platlib"],
>> os.path.join(sys.prefix, "Lib", "site-packages"),
>> os.path.join(sys.exec_prefix, "Lib", "site-packages")
>> ]
>>
>> # 去重并添加可能的子目录
>> search_paths = set()
>> for path in possible_paths:
>> if os.path.exists(path):
>> search_paths.add(path)
>> # 添加所有子目录
>> search_paths.update(
>> os.path.join(path, d) for d in os.listdir(path)
>> if os.path.isdir(os.path.join(path, d))
>> )
>>
>> # 在所有可能路径中搜索并删除.pth文件
>> removed = False
>> for path in search_paths:
>> pth_path = os.path.join(path, 'distutils-precedence.pth')
>> if os.path.exists(pth_path):
>> try:
>> # 尝试删除文件
>> os.remove(pth_path)
>> print(f"[SUCCESS] Removed .pth file: {pth_path}")
>> removed = True
>> except Exception as e:
>> # 如果删除失败,尝试移动文件
>> try:
>> backup_path = pth_path + ".bak"
>> shutil.move(pth_path, backup_path)
>> print(f"[SUCCESS] Moved .pth file to backup: {backup_path}")
>> removed = True
>> except Exception as e2:
>> print(f"[ERROR] Failed to handle .pth file: {str(e2)}")
>> traceback.print_exc()
>>
>> if not removed:
>> print("[INFO] No .pth file found in any location")
>>
>> except Exception as e:
>> print(f"[CRITICAL] Error: {str(e)}")
>> traceback.print_exc()
>>
>> # 注册退出时检查
>> atexit.register(self.verify_clean_environment)
>>
>> def verify_clean_environment(self):
>> """Verify no .pth file exists after installation"""
>> for path in [
>> sysconfig.get_paths()["purelib"],
>> os.path.join(sys.prefix, "Lib", "site-packages")
>> ]:
>> pth_path = os.path.join(path, 'distutils-precedence.pth')
>> if os.path.exists(pth_path):
>> print(f"[WARNING] .pth file still present: {pth_path}")
>> '@ | Set-Content -Path $pluginFile -Encoding ASCII -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 -Encoding ASCII -Force
>>
>> # 创建pyproject.toml文件
>> $pyprojectFile = "$pluginRoot\pyproject.toml"
>> @'
>> [build-system]
>> requires = ["setuptools>=40.8.0", "wheel"]
>> build-backend = "setuptools.build_meta"
>> '@ | Set-Content -Path $pyprojectFile -Encoding ASCII -Force
>>
>> # 安装插件(使用常规安装模式)
>> Push-Location -Path $pluginRoot
>> try {
>> # 使用常规模式安装(非可编辑模式)
>> python -m pip install . --no-deps --force-reinstall --no-warn-script-location
>> } catch {
>> Write-Host "❌ Failed to install plugin: $_" -ForegroundColor Red
>> }
>> Pop-Location
>>
>> Write-Host "✅ pth_fix plugin installed successfully" -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"
>> )
>>
>> # 验证核心组件
>> $coreComponents = 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__}')"
>> Write-Host $coreComponents
>>
>> # 验证警告
>> $warnings = python -c "import warnings; warnings.filterwarnings('error'); import modelscope" 2>&1
>> if ($LASTEXITCODE -eq 0) {
>> Write-Host "✅ Environment has no warnings" -ForegroundColor Green
>> } else {
>> Write-Host "❌ Environment has warnings: $warnings" -ForegroundColor Red
>> }
>>
>> # 验证.pth文件
>> $sitePackages = "$PythonPath\Lib\site-packages"
>> if (Test-Path $sitePackages) {
>> $pthFiles = Get-ChildItem $sitePackages -Recurse -Filter "distutils-precedence.pth" -ErrorAction SilentlyContinue
>>
>> if ($pthFiles) {
>> Write-Host "⚠️ Found .pth file: $($pthFiles.FullName)" -ForegroundColor Yellow
>> } else {
>> Write-Host "✅ No distutils-precedence.pth file found" -ForegroundColor Green
>> }
>>
>> # 增强的入口点验证
>> $pluginStatus = python -c @"
>> import sys
>> import os
>> import traceback
>> from importlib.metadata import entry_points, distribution
>>
>> try:
>> # 检查插件是否已安装
>> dist = distribution('pth_fix_plugin')
>> print(f"Plugin installed: {dist.metadata['Name']} v{dist.metadata['Version']}")
>>
>> # 检查入口点是否注册
>> install_eps = entry_points(group='distutils.commands', name='install')
>>
>> if not install_eps:
>> print('ERROR: No install command entry points found')
>> sys.exit(1)
>>
>> pth_fix_found = any('pth_fix_plugin' in ep.value for ep in install_eps)
>>
>> if pth_fix_found:
>> print('SUCCESS: Install command hook active')
>> else:
>> print('ERROR: Install command not hooked')
>> sys.exit(1)
>>
>> except Exception as e:
>> print(f'ERROR: {str(e)}')
>> traceback.print_exc()
>> sys.exit(1)
>> "@
>>
>> # 解析插件状态输出
>> if ($pluginStatus -match "ERROR:") {
>> Write-Host "❌ Plugin status check failed: $pluginStatus" -ForegroundColor Red
>> } elseif ($pluginStatus -match "SUCCESS:") {
>> Write-Host "✅ $($pluginStatus | Select-String 'SUCCESS:.*')" -ForegroundColor Green
>> } else {
>> Write-Host $pluginStatus
>> }
>> } else {
>> Write-Host "❌ Path does not exist: $sitePackages" -ForegroundColor Red
>> }
>> }
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # ===== 执行最终修复 =====
PS C:\Users\Administrator\Desktop> # 1. 卸载现有插件
PS C:\Users\Administrator\Desktop> python -m pip uninstall -y pth_fix_plugin
Found existing installation: pth_fix_plugin 1.0.0
Uninstalling pth_fix_plugin-1.0.0:
Successfully uninstalled pth_fix_plugin-1.0.0
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # 2. 确保插件目录完全删除
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 "Removed old plugin directory: $pluginPath" -ForegroundColor Cyan
>> }
Removed old plugin directory: E:\Python310\Lib\site-packages\pth_fix_plugin
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # 3. 手动删除所有可能的.pth文件
PS C:\Users\Administrator\Desktop> $searchPaths = @(
>> "E:\Python310\Lib\site-packages",
>> "E:\Python310\Lib\site-packages\distutils-precedence.pth",
>> "E:\Python310\Lib\site-packages\*.dist-info",
>> "E:\Python310\Lib\site-packages\*.egg-info"
>> )
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> foreach ($path in $searchPaths) {
>> if (Test-Path $path) {
>> Get-ChildItem $path -Recurse -Filter "distutils-precedence.pth" | ForEach-Object {
>> Remove-Item $_.FullName -Force
>> Write-Host "Removed .pth file: $($_.FullName)" -ForegroundColor Yellow
>> }
>>
>> # 删除备份文件
>> Get-ChildItem $path -Recurse -Filter "distutils-precedence.pth.bak" | ForEach-Object {
>> Remove-Item $_.FullName -Force
>> Write-Host "Removed backup file: $($_.FullName)" -ForegroundColor DarkYellow
>> }
>> }
>> }
Removed .pth file: E:\Python310\Lib\site-packages\distutils-precedence.pth
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # 4. 重新安装插件
PS C:\Users\Administrator\Desktop> Install-PthFixPlugin -PythonPath "E:\Python310"
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing e:\python310\lib\site-packages\pth_fix_plugin
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pth_fix_plugin
Building wheel for pth_fix_plugin (pyproject.toml) ... done
Created wheel for pth_fix_plugin: filename=pth_fix_plugin-1.0.0-py3-none-any.whl size=2315 sha256=bade234c98098fab9610d063b1b29131a85033c07271f7a0c36a375345545518
Stored in directory: C:\Users\Administrator\AppData\Local\Temp\pip-ephem-wheel-cache-2j8ktxyt\wheels\c7\cc\8f\a13f1f3c2e3c649409279b7caed95e5210d22da47147eaf764
Successfully built pth_fix_plugin
Installing collected packages: pth_fix_plugin
Successfully installed pth_fix_plugin-1.0.0
✅ pth_fix plugin installed successfully
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # 5. 验证环境
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
✅ Environment has no warnings
✅ No distutils-precedence.pth file found
File "<string>", line 9
print(fPlugin
^
SyntaxError: '(' was never closed
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # 6. 测试修复持久性
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>
PS C:\Users\Administrator\Desktop> # 7. 重新验证环境(确保插件在升级后仍有效)
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
✅ Environment has no warnings
⚠️ Found .pth file: E:\Python310\Lib\site-packages\distutils-precedence.pth
File "<string>", line 9
print(fPlugin
^
SyntaxError: '(' was never closed
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 sysconfig
>> import traceback
>> import shutil
>> import atexit
>> from setuptools.command.install import install
>>
>> class CustomInstallCommand(install):
>> """Custom install command to prevent .pth file generation"""
>>
>> def run(self):
>> # 调用原始安装方法
>> install.run(self)
>>
>> # 修复.pth文件
>> self.fix_pth_file()
>>
>> def fix_pth_file(self):
>> """Fix the .pth file issue with enhanced logic"""
>> try:
>> # 获取所有可能的site-packages路径
>> possible_paths = [
>> sysconfig.get_paths()["purelib"],
>> sysconfig.get_paths()["platlib"],
>> os.path.join(sys.prefix, "Lib", "site-packages"),
>> os.path.join(sys.exec_prefix, "Lib", "site-packages")
>> ]
>>
>> # 去重并添加可能的子目录
>> search_paths = set()
>> for path in possible_paths:
>> if os.path.exists(path):
>> search_paths.add(path)
>> # 添加所有子目录
>> search_paths.update(
>> os.path.join(path, d) for d in os.listdir(path)
>> if os.path.isdir(os.path.join(path, d))
>> )
>>
>> # 在所有可能路径中搜索并删除.pth文件
>> removed = False
>> for path in search_paths:
>> pth_path = os.path.join(path, 'distutils-precedence.pth')
>> if os.path.exists(pth_path):
>> try:
>> # 尝试删除文件
>> os.remove(pth_path)
>> print(f"[SUCCESS] Removed .pth file: {pth_path}")
>> removed = True
>> except Exception as e:
>> # 如果删除失败,尝试移动文件
>> try:
>> backup_path = pth_path + ".bak"
>> shutil.move(pth_path, backup_path)
>> print(f"[SUCCESS] Moved .pth file to backup: {backup_path}")
>> removed = True
>> except Exception as e2:
>> print(f"[ERROR] Failed to handle .pth file: {str(e2)}")
>> traceback.print_exc()
>>
>> if not removed:
>> print("[INFO] No .pth file found in any location")
>>
>> except Exception as e:
>> print(f"[CRITICAL] Error: {str(e)}")
>> traceback.print_exc()
>>
>> # 注册退出时检查
>> atexit.register(self.verify_clean_environment)
>>
>> def verify_clean_environment(self):
>> """Verify no .pth file exists after installation"""
>> for path in [
>> sysconfig.get_paths()["purelib"],
>> os.path.join(sys.prefix, "Lib", "site-packages")
>> ]:
>> pth_path = os.path.join(path, 'distutils-precedence.pth')
>> if os.path.exists(pth_path):
>> print(f"[WARNING] .pth file still present: {pth_path}")
>> '@ | Set-Content -Path $pluginFile -Encoding ASCII -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 -Encoding ASCII -Force
>>
>> # 创建pyproject.toml文件
>> $pyprojectFile = "$pluginRoot\pyproject.toml"
>> @'
>> [build-system]
>> requires = ["setuptools>=40.8.0", "wheel"]
>> build-backend = "setuptools.build_meta"
>> '@ | Set-Content -Path $pyprojectFile -Encoding ASCII -Force
>>
>> # 安装插件(使用常规安装模式)
>> Push-Location -Path $pluginRoot
>> try {
>> # 使用常规模式安装(非可编辑模式)
>> python -m pip install . --no-deps --force-reinstall --no-warn-script-location
>> } catch {
>> Write-Host "❌ Failed to install plugin: $_" -ForegroundColor Red
>> }
>> Pop-Location
>>
>> Write-Host "✅ pth_fix plugin installed successfully" -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"
>> )
>>
>> # 验证核心组件
>> $coreComponents = 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__}')"
>> Write-Host $coreComponents
>>
>> # 验证警告
>> $warnings = python -c "import warnings; warnings.filterwarnings('error'); import modelscope" 2>&1
>> if ($LASTEXITCODE -eq 0) {
>> Write-Host "✅ Environment has no warnings" -ForegroundColor Green
>> } else {
>> Write-Host "❌ Environment has warnings: $warnings" -ForegroundColor Red
>> }
>>
>> # 验证.pth文件
>> $sitePackages = "$PythonPath\Lib\site-packages"
>> if (Test-Path $sitePackages) {
>> $pthFiles = Get-ChildItem $sitePackages -Recurse -Filter "distutils-precedence.pth" -ErrorAction SilentlyContinue
>>
>> if ($pthFiles) {
>> Write-Host "⚠️ Found .pth file: $($pthFiles.FullName)" -ForegroundColor Yellow
>> } else {
>> Write-Host "✅ No distutils-precedence.pth file found" -ForegroundColor Green
>> }
>>
>> # 增强的入口点验证
>> $pluginStatus = python -c @"
>> import sys
>> import os
>> import traceback
>> from importlib.metadata import entry_points, distribution
>>
>> try:
>> # 检查插件是否已安装
>> dist = distribution('pth_fix_plugin')
>> print(f"Plugin installed: {dist.metadata['Name']} v{dist.metadata['Version']}")
>>
>> # 检查入口点是否注册
>> install_eps = entry_points(group='distutils.commands', name='install')
>>
>> if not install_eps:
>> print('ERROR: No install command entry points found')
>> sys.exit(1)
>>
>> pth_fix_found = any('pth_fix_plugin' in ep.value for ep in install_eps)
>>
>> if pth_fix_found:
>> print('SUCCESS: Install command hook active')
>> else:
>> print('ERROR: Install command not hooked')
>> sys.exit(1)
>>
>> except Exception as e:
>> print(f'ERROR: {str(e)}')
>> traceback.print_exc()
>> sys.exit(1)
>> "@
>>
>> # 解析插件状态输出
>> if ($pluginStatus -match "ERROR:") {
>> Write-Host "❌ Plugin status check failed: $pluginStatus" -ForegroundColor Red
>> } elseif ($pluginStatus -match "SUCCESS:") {
>> Write-Host "✅ $($pluginStatus | Select-String 'SUCCESS:.*')" -ForegroundColor Green
>> } else {
>> Write-Host $pluginStatus
>> }
>> } else {
>> Write-Host "❌ Path does not exist: $sitePackages" -ForegroundColor Red
>> }
>> }
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # ===== 执行最终修复 =====
PS C:\Users\Administrator\Desktop> # 1. 卸载现有插件
PS C:\Users\Administrator\Desktop> python -m pip uninstall -y pth_fix_plugin
Found existing installation: pth_fix_plugin 1.0.0
Uninstalling pth_fix_plugin-1.0.0:
Successfully uninstalled pth_fix_plugin-1.0.0
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # 2. 确保插件目录完全删除
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 "Removed old plugin directory: $pluginPath" -ForegroundColor Cyan
>> }
Removed old plugin directory: E:\Python310\Lib\site-packages\pth_fix_plugin
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # 3. 手动删除所有可能的.pth文件
PS C:\Users\Administrator\Desktop> $searchPaths = @(
>> "E:\Python310\Lib\site-packages",
>> "E:\Python310\Lib\site-packages\distutils-precedence.pth",
>> "E:\Python310\Lib\site-packages\*.dist-info",
>> "E:\Python310\Lib\site-packages\*.egg-info"
>> )
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> foreach ($path in $searchPaths) {
>> if (Test-Path $path) {
>> Get-ChildItem $path -Recurse -Filter "distutils-precedence.pth" | ForEach-Object {
>> Remove-Item $_.FullName -Force
>> Write-Host "Removed .pth file: $($_.FullName)" -ForegroundColor Yellow
>> }
>>
>> # 删除备份文件
>> Get-ChildItem $path -Recurse -Filter "distutils-precedence.pth.bak" | ForEach-Object {
>> Remove-Item $_.FullName -Force
>> Write-Host "Removed backup file: $($_.FullName)" -ForegroundColor DarkYellow
>> }
>> }
>> }
Removed .pth file: E:\Python310\Lib\site-packages\distutils-precedence.pth
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # 4. 重新安装插件
PS C:\Users\Administrator\Desktop> Install-PthFixPlugin -PythonPath "E:\Python310"
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Processing e:\python310\lib\site-packages\pth_fix_plugin
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pth_fix_plugin
Building wheel for pth_fix_plugin (pyproject.toml) ... done
Created wheel for pth_fix_plugin: filename=pth_fix_plugin-1.0.0-py3-none-any.whl size=2315 sha256=b847a78506e0fe8125855f49f56387d6086160392cd987a3f7d123c826ffca43
Stored in directory: C:\Users\Administrator\AppData\Local\Temp\pip-ephem-wheel-cache-j61dy6q6\wheels\c7\cc\8f\a13f1f3c2e3c649409279b7caed95e5210d22da47147eaf764
Successfully built pth_fix_plugin
Installing collected packages: pth_fix_plugin
Successfully installed pth_fix_plugin-1.0.0
✅ pth_fix plugin installed successfully
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # 5. 验证环境
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
✅ Environment has no warnings
✅ No distutils-precedence.pth file found
File "<string>", line 9
print(fPlugin
^
SyntaxError: '(' was never closed
PS C:\Users\Administrator\Desktop>
PS C:\Users\Administrator\Desktop> # 6. 测试修复持久性
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>
PS C:\Users\Administrator\Desktop> # 7. 重新验证环境(确保插件在升级后仍有效)
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
✅ Environment has no warnings
⚠️ Found .pth file: E:\Python310\Lib\site-packages\distutils-precedence.pth
File "<string>", line 9
print(fPlugin
^
SyntaxError: '(' was never closed
PS C:\Users\Administrator\Desktop>
最新发布