Anaconda 提示立即关闭 - 系统无法找到指定的注册表项或值

2022-01-10 00:00:00 python visual-studio anaconda

问题描述

我在使用 Anaconda 提示时遇到问题.

在我创建一个包含

最后一个错误:错误"消息转换为:系统无法找到指定的注册表项或值".

现在奇怪的是,当我从导航器而不是提示符启动应用程序时,我可以访问我的环境并从那里启动我的笔记本或可视代码工作室,但对于不起作用的基本环境.

但是试图打开提示会立即关闭它,我相信它正在访问默认环境base".此外,从导航器中,我无法从基地"启动笔记本.环境.

图片在这里:

虽然我说过,其他环境都可以.

有谁知道如何解决这个问题?由于它,我无法访问提示,我只是幸运地抓住它并截取了屏幕截图,否则它会立即关闭.

P.S :我在联想笔记本电脑上使用 Windows 10,Python 3.7 并且在今天之前从未遇到过问题.

谢谢

解决方案

在我更新了我所有的包之后,这也发生在我身上.我做了一些挖掘,错误来自 C:UsersusernameAppDataLocalContinuumminiconda3etccondaactivate.dvs2015_compiler_vars.bat

这个文件有你的错误之前的最后一行:

for/f "skip=2 tokens=2,*" %%A in ('reg query "%VSREGKEY%"/v InstallDir') do SET "VSINSTALLDIR=%%B"

如果您在 Windows 命令提示符下运行 reg query "%VSREGKEY%"/v InstallDir,您将得到与您在 Anaconda 提示符下看到的相同的错误.

我尝试进行一些更改来处理此错误,但即使您设法克服了这个错误,您最终也可能会收到此错误:在注册表或 VS140COMNTOOLS 环境变量中找不到 VS - 正在退出发生这种情况是因为 VSINSTALLDIR bash 变量用于稍后在脚本中查找 vcvarsall.bat 文件,但现在该目录显示为空.

我无法在我的系统中找到任何 vcvarsall.bat 文件,可能是因为我没有安装此文件所适用的 Visual Studio.一种解决方案是安装 Visual Studio(2015 版)并确保您拥有 InstallDir 注册表项.但我没有这样做,因为 VS 是一个相当大的程序(我认为是 7 GB),我目前还没有用.

我采取的解决方案是简单地删除 C:UsersusernameAppDataLocalContinuumminiconda3etcconda.我创建了一个新的 miniconda 安装(在不同的路径中),发现该目录由于某种原因在其中不存在,所以我想重新安装会做同样的事情.我删除了第二个安装,第一个仍在工作,所以我怀疑是否涉及任何依赖关系问题.也就是说,我不知道该脚本的用途,也不知道没有它会产生什么后果.完全披露.

I'm having an issue with the Anaconda prompt.

Everything was find until I created a new environment with PyMC3 in it.

The usual way : conda create -n myenv

and then, after I activated it : conda install -c conda-forge pymc3

For some reason the packages weren't installed so I deleted the environment.

Now, I'm getting this error, see picture here :

The last "error : error" message translates to : "the system was unable to find the specified registry key or value".

Now what's weird is that when I start the application from the navigator instead of the prompt, I can access my envs and launch my notebook or visual code studio from there but for the base environment which doesn't work.

But trying to open the prompt closes it immediately, I believe it is accessing "base", the default env. Also, from the navigator I'm unable to launch a notebook from the "base" env.

Picture here :

Though as I said, other environments are fine.

Does anyone know how to solve this issue ? I can't access the prompt because of it, I was just lucky enough to grab it and take a screenshot, it closes immediatlely otherwise.

P.S : I use Windows 10 on a Lenovo laptop, Python 3.7 and never had the issue before today.

Thanks

解决方案

This just happened to me as well after updating all of my packages. I did some digging and the error is coming from C:UsersusernameAppDataLocalContinuumminiconda3etccondaactivate.dvs2015_compiler_vars.bat

This file has your last line before your error:

for /f "skip=2 tokens=2,*" %%A in ('reg query "%VSREGKEY%" /v InstallDir') do SET "VSINSTALLDIR=%%B"

And if you run reg query "%VSREGKEY%" /v InstallDiron your Windows command prompt, you'll get the same error you see on your Anaconda prompt.

I tried making some changes to handle this error but even if you manage to get past that you will likely end up getting this error : Did not find VS in registry or in VS140COMNTOOLS env var - exiting This is happening because the VSINSTALLDIR bash variable is meant for finding the vcvarsall.bat file later in the script but now that directory shows up as empty.

I wasn't able to find any vcvarsall.bat file in my system, likely because I haven't installed Visual Studio which this file is meant for. One solution is to install Visual Studio (2015 version) and make sure you have the InstallDir registry key for it. But I didn't do this since VS is a pretty big program (7 GB I think) that I have no use for that at the moment.

The solution I took is to simply delete C:UsersusernameAppDataLocalContinuumminiconda3etcconda. I created a new miniconda installation (in a different path) and saw that this directory did not exist in it for whatever reason so I imagine that reinstalling would do the same thing. I deleted the second installation and the first one is still working so I doubt there's any dependencies issues involved. That said, I have no idea what that script was meant for and do not know what consequences may come without it. Full disclosure.

相关文章