问题
I'm just getting started with Python and I want to use Visual Studio 2015 Community Edition (VS) for writing my code. However, after diligently following the instructions on GitHub (1) Install PTVS 2.2.2 (2) Install Windows Python 3.4.4, VS cannot find the Python interpreter and run the code. When I attempt to do so for VS manually via Options > Python Tools > Environment Option, all the buttons are greyed out (I cannot enter information) as well as the Python Environment Window
I've tried uninstalling, reinstalling, repairing and modifying VS, PTVS and Python 3.4 but to no avail. Is there something I'm missing? Much appreciate the help!
回答1:
- Right-tap the lower-left corner and choose Run in the Quick Access Menu.
- Type regedit and tap OK in the Run dialog. Go to: KEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\PythonTools\Interpreters
- Delete or Rename folder in this directory (you can see that some keys are referring to the 3.6 version).
- Start Visual Studio 2015.
回答2:
It seems Visual Studio 2015 Community Edition does not like Python 3.6. If you just edit the registry:
KEY_CURRENT_USER\Software\Microsoft\VisualStudio\14.0\PythonTools\Interpreters
as Luciano suggested, and replace the version key from 3.6 to 3.5 it works.
来源:https://stackoverflow.com/questions/40430831/vs-2015-python-environments-greyed-out