Visual Studio Python Environments window does not display

你离开我真会死。 提交于 2019-12-30 07:46:05

问题


I have installed Win10, Visual Studio 2015, Python 2.7, Python 3.5 and PTVS 2.2.3.

Unfortunately PTVS does not work at all. I can not load any Python projects that were loading previously in Visual Studio. It worked before I installed Python 3.5. I tried to uninstall Python 2.7 and get an error saying that the uninstall didn't success. After several tries, the problem appears to be around pip which is somehow blocking both install and uninstall of Python 2.7.

When trying to open Python Tools from Tools menu, nothing happens. Neither window opens nor any error message is displayed. Python Environments window does not open even with the shortcut.

In Tools > Options > Python Tools, the only text shown is: "An error occurred loading this property page".

When I try to load/reload the Python project, the message is: "error : Expected 1 export(s) with contract name "Microsoft.PythonTools.Interpreter.IInterpreterOptionsService" but found 0 after applying applicable constraints." This has already been posted for 11 days ago, but no one has answered.

To solve this, I would like to know how to make the Python Environment window appearing in Visual Studio.

Thanks for any help.


回答1:


VS keeps a cache of loaded assemblies that doesn't always get invalidated when it should.

If you delete C:\Users\You\AppData\Local\Microsoft\VisualStudio\14.0\ComponentModelCache and restart you should be fine. src: https://github.com/Microsoft/PTVS/issues/1388




回答2:


You'll need to open the ActivityLog.xml (%APPDATA%\Microsoft\VisualStudio\14.0\ActivityLog.xml) and see if there's any exceptions there related to PTVS.

It sounds like you have a pretty messed up configuration at this point. You could try uninstalling PTVS and re-installing it, but my guess is your messed up Python installs are somehow throwing PTVS off and causing it to crash somewhere.




回答3:


I`m also having similar issues, first installation path:

  • Visual Studio 2015 Pro with Update 1
  • Installed PTVS using the VS2015 installation setup later on
  • Everything work fine

The issues started:

  • Installed a DEV version of PTVS from their github page
  • My pyproj stopped loading saying a migration needed
  • Noticed that after new PTVS installation, I`ve installed VS2015 Update 2

Not being able to reload my project after trying to debug the issue, I`ve decided to:

  • Uninstall PTVS and
  • Reinstall PTVS through VS2015 setup

Now the issue was different, while trying to load my previous pyproj or even creating different Python projects using multiple templates. I was getting this error:

"There is a missing project subtype. Subtype: '{1b580a1a-fdb3-4b32-83e1-6407eb2722e6}' is unsupported by this installation."

Not finding anything around this, I`ve:

  • Uninstalled Visual Studio 2015 (having Update 2)
  • Reinstalled Visual Studio 2015 with Update 1 (without checking PTVS, who requires VS 2015 Update 2 to be installed as well, I suspected it has something to do with it)
  • Installed PTVS latest stable version from their Github

Now Visual Studio is crashing while trying to load the past mentioned pyproj, with the same error as OP:

SetSite failed for package [Python Tools Package][Expected 1 export(s) with contract name "Microsoft.PythonTools.Interpreter.IInterpreterOptionsService" but found 0 after applying applicable constraints.]

Still trying to fix it at the moment. Maybe these steps will help debugging the issue.

Update / Fixed

After installing VS 2015 with Update 1 and PTVS 2.2 for VS 2015, I was still having issues opening the pyproj causing VS to just crash (unfortunately nothing in ActivityLog.xml).

I've tried repairing Visual Studio through it's setup, still the same issue.

Finally, I've decided to re-update Visual Studio 2015 to Update 2, causing also to update PTVS to March release, all through VS setup utility.

And now my pyproj correctly opens. Probably some versions miss match during the initial steps where I've installed a DEV version of PTVS. Not sure which step actually corrected my issue but it did.

Hope this will help somehow other people with similar issues.




回答4:


Thanks for your posts. My problem was fixed after I installed VS 2015 update 3 which included a new release of PTVS (June 2.2.40623).



来源:https://stackoverflow.com/questions/37721461/visual-studio-python-environments-window-does-not-display

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!