【问题标题】:Set-ItemProperty message when importing virtualenvwrapper导入 virtualenvwrapper 时的 Set-ItemProperty 消息
【发布时间】:2014-02-18 22:44:35
【问题描述】:

这是我收到的信息。对于它的价值,我打开我的注册表并注意到没有 2.7 文件夹, PythonCore 直接进入 InstallPath 。有什么想法吗?

Set-ItemProperty : Cannot find path 'HKCU:\Software\Python\PythonCore\2.7\InstallPath' because it does not exist.
At C:\Users\...\Documents\WindowsPowerShell\Modules\virtualenvwrapper\win.psm1:127 char:21
+     set-itemproperty <<<<  -path "HKCU:/Software/Python/PythonCore/$pyVer/InstallPath" -name "(default)" -value $pyBa
se
    + CategoryInfo          : ObjectNotFound: (HKCU:\Software\...2.7\InstallPath:String) [Set-ItemProperty], ItemNotFo
   undException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

Set-ItemProperty : Cannot find path 'HKCU:\Software\Python\PythonCore\2.7\PythonPath' because it does not exist.
At C:\Users\...\Documents\WindowsPowerShell\Modules\virtualenvwrapper\win.psm1:128 char:21
+     set-itemproperty <<<<  -path "HKCU:/Software/Python/PythonCore/$pyVer/PythonPath" -name "(default)" -value "$pyBa
se\Lib;$pyBase\DLLs;$pyBase\Lib\lib-tk"
    + CategoryInfo          : ObjectNotFound: (HKCU:\Software\...\2.7\PythonPath:String) [Set-ItemProperty], ItemNotFo
   undException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand

【问题讨论】:

  • 运气好能解决这个问题吗?我也有同样的问题。

标签: python powershell virtualenvwrapper


【解决方案1】:

我遇到了同样的问题,四处搜索并设法解决了解决方案。这就是我遇到的。

Python 似乎会更新 HKEY_CURRENT_USER 下的注册表,并且某些安装会在 HKEY_LOCAL_MACHINE 下查找 python。

我遇到的有用资源

所以假设你的 python 安装在C:\python27

来自Restoring Your Python Registry in Windows的这篇文章-

  1. 17 - 21 行复制,

    [HKEY_CURRENT_USER\Software\Python\Pythoncore\2.7\InstallPath]
    @="C:\python27"

    [HKEY_CURRENT_USER\Software\Python\Pythoncore\2.7\PythonPath] @="C:\python27;C:\python27\Lib\;C:\python27\DLLs\"

  2. 将它们粘贴到文本文件中。
  3. 将其重命名为 fix_python.reg 或任何您想要的名称 :)
  4. 双击该文件,然后按照提示将新值加载到 Windows 注册表中。
可能不是最好的方法。但这对我来说效果很好。

希望对你有帮助。

【讨论】:

  • 谢谢!为我工作。不要忘记包括:“Windows 注册表编辑器 5.00 版”
【解决方案2】:

我使用的是 Windows 10,必须手动添加。这是我所做修改的导出:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\SOFTWARE\Python]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7]

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7\InstallPath]
@="C:\\python27"

[HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\2.7\PythonPath]
@="C:\\python27;C:\\python27\\Lib\\;C:\\python27\\DLLs\\"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-08-19
    • 2015-09-14
    • 1970-01-01
    • 2012-06-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多