简体   繁体   English

如何将 Python 3.6 安装移动到不同的目录?

[英]How do I move a Python 3.6 installation a different directory?

I have installed Python 3.6.2 Windows in我已经安装了 Python 3.6.2 Windows

c:\\users\\username\\AppData\\Local\\programs\\Python\\Python36

(because that is the (totally stupid) default. (因为这是(完全愚蠢的)默认设置。

I have manually moved that into c:\\我已手动将其移至c:\\

But the update to Python 3.6.3 still installs to the original target.但是 Python 3.6.3的更新仍会安装到原始目标。

How do I change this (without uninstalling (which would also uninstall all packages))?我该如何更改(不卸载(这也会卸载所有软件包))?

I am not sure this will be the best answer though the simplest thing to do if you are stuck you could try this.我不确定这将是最好的答案,但如果您遇到困难,可以尝试这个最简单的方法。

You could move you installation back to its original location, then update it.您可以将安装移回其原始位置,然后更新它。 Then once complete move it to where you want.然后一旦完成将其移动到您想要的位置。


Alternatively, there is a registry value that shows Python installation path.或者,有一个显示 Python 安装路径的注册表值。 I would check to see if this reflects your new path, if not then updating it may allow your update to work.我会检查这是否反映了您的新路径,如果没有,则更新它可能会使您的更新生效。 The location of the registry on my machine is:我机器上注册表的位置是:

Computer\HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\3.6\InstallPath

Most likely, the problem is that you didn't change the environment PATH in your windows settings.最有可能的问题是您没有在 Windows 设置中更改环境 PATH。 If you modify the path to c:\\Python36 folder everything should be back to norm.如果您修改 c:\\Python36 文件夹的路径,一切都应该恢复正常。

Here are instructions how to do this Modify environment PATH on Windows以下是如何在 Windows 上执行此修改环境路径的说明

If you installed Python for all users, the registry path (64bit Python on 64bit OS) would be:如果您为所有用户安装了 Python,则注册表路径(64 位操作系统上的 64 位 Python)将为:

  • HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.8\\Idle HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.8\\Idle
  • HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.8\\InstallPath HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.8\\InstallPath
  • HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.8\\PythonPath HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.8\\PythonPath
  • HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.8\\Help\\Main Python Documentation HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\3.8\\Help\\Main Python Documentation
  • HKEY_CLASSES_ROOT\\Python.File\\Shell\\editwithidle\\shell\\edit38\\command HKEY_CLASSES_ROOT\\Python.File\\Shell\\editwithidle\\shell\\edit38\\command
  • HKEY_CLASSES_ROOT\\Python.NoConFile\\Shell\\editwithidle\\shell\\edit38\\command HKEY_CLASSES_ROOT\\Python.NoConFile\\Shell\\editwithidle\\shell\\edit38\\command

I had faced similar problem.我遇到过类似的问题。 For some reason I wanted to change the PC admin but my Python was installed on the old user directory.出于某种原因,我想更改 PC 管理员,但我的 Python 安装在旧用户目录中。 All updates and repairs I had to do on the same directory.我必须在同一目录中进行所有更新和修复。

Then I deleted the python path from registry (Since I wanted to have fresh install later): Computer\\HKEY_CURRENT_USER\\SOFTWARE\\Python and then reinstalled python.然后我从注册表中删除了 python 路径(因为我想稍后重新安装): Computer\\HKEY_CURRENT_USER\\SOFTWARE\\Python ,然后重新安装了 python。

PS: While installing on your home PC its better to install across users. PS:在您的家用 PC 上安装时,最好跨用户安装。 My python is installed at below location: C:\\Program Files\\Python37我的 python 安装在以下位置: C:\\Program Files\\Python37

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM