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"

相关推荐
dFObBIMmai几秒前
MySQL主从同步中大事务导致的延迟_如何拆分大事务优化同步
jvm·数据库·python
szccyw03 分钟前
mysql如何限制特定存储过程执行权限_MySQL存储过程安全访问
jvm·数据库·python
小白学大数据9 分钟前
Python 自动化爬取网易云音乐歌手歌词实战教程
爬虫·python·okhttp·自动化
dllmayday1 小时前
Linux 上用终端连接 WiFi
linux·服务器·windows
风之所往_2 小时前
Python 3.0 新特性全面总结
python
2401_882273722 小时前
如何在 CSS 中正确加载本地 JPG 背景图片
jvm·数据库·python
老花眼猫2 小时前
编制椭圆旋转绘图函数
c语言·经验分享·青少年编程·课程设计
Lucas_coding2 小时前
【Claude Code Router】 Claude Code 兼容 OpenAI 格式 API, Claude code 接入本地部署模型
人工智能·python
测试员周周2 小时前
【AI测试系统】第5篇:从 Archon 看 AI 工程化落地:为什么"确定性编排+AI 弹性智能"是终局?
人工智能·python·测试
大飞记Python3 小时前
【2026更新】Python基础学习指南(AI版)——04数据类型
开发语言·人工智能·python