Python安装在C盘后如何移到D盘

修正的方案三:使用符号链接(PowerShell版本)

步骤1:停止Python进程并移动文件

powershell

以管理员身份运行PowerShell

1. 停止所有Python进程

Stop-Process -Name "python" -Force -ErrorAction SilentlyContinue

Stop-Process -Name "pythonw" -Force -ErrorAction SilentlyContinue

2. 创建D盘目录

New-Item -ItemType Directory -Path "D:\Python39" -Force

3. 移动Python文件夹到D盘

Move-Item -Path "C:\Users\admin\AppData\Local\Programs\Python\Python39" -Destination "D:\Python39" -Force

4. 验证移动成功

Test-Path "D:\Python39\Python39\python.exe"

步骤2:创建符号链接

powershell

创建符号链接(需要管理员权限)

New-Item -ItemType SymbolicLink -Path "C:\Users\admin\AppData\Local\Programs\Python\Python39" -Target "D:\Python39\Python39"

或者使用junction(目录连接)

步骤3:验证链接

powershell

验证符号链接

Get-Item "C:\Users\admin\AppData\Local\Programs\Python\Python39" | Format-List

测试Python

& "D:\Python39\python.exe" --version

python --version

查看链接详情

cmd /c dir "C:\Users\admin\AppData\Local\Programs\Python\Python39"

相关推荐
mg6682 小时前
0基础开发学习python工具_____一键打包!用 PyInstaller 将 Python 烟花程序转为 .exe(无需 Python 环境)
开发语言·python
helloworld也报错?2 小时前
目标检测系列之YOLOv11——v8模型的继续改进
人工智能·python·目标检测·目标跟踪
ray9633 小时前
Python——函数参数传递方式
开发语言·python
codists3 小时前
2025年12月文章一览
python
梅羽落3 小时前
python武器化开发_01
开发语言·python·php
Herbert_hwt3 小时前
C语言位操作符详解:从入门到实战应用
c语言·算法
逍遥德3 小时前
JPA 操作对象图 (Object Graph) 详解
开发语言·python
芒鸽3 小时前
windows上使用Lycium 交叉编译移植鸿蒙三方库指南
windows·华为·harmonyos