Windows Forms in Visual Studio with Python

10,955

If you're getting the following error unable to resolve 'clr':

Example Error

It's likely that you don't have a python interpreter installed or configured for Visual Studio

Per the question The environment ironpython 2.7-32 appears to be incorrectly configured or missing

The Visual Studio Installer does not include an IronPython Package option to install

So you need to:

  1. Download IronPython from Github and install it
  2. Then, select the correct Python environment within your VS project.
Share:
10,955
user1746636
Author by

user1746636

Updated on June 04, 2022

Comments

  • user1746636
    user1746636 almost 2 years

    Steps to reproduce:

    1. I created a new project in Visual Studio
    2. Selected Python > Desktop > "IronPython Windows Forms Application"

    However, as soon as I open the project I encountered several errors which I don't know how to solve. The errors are unresolved import clr an similar.

    Brand New Windows Forms Python Project

    • KyleMit
      KyleMit about 5 years
      Can you include the full text of the error message you're getting?
    • user1746636
      user1746636 almost 5 years
      Yes. The full text error says "unresolved import clr", "unresolved import System.Drawing", "unresolved import System.Windows.Forms".
    • KyleMit
      KyleMit almost 5 years
      Did the steps I listed below help solve your problem?
  • user1746636
    user1746636 almost 5 years
    Hi KyleMit, sorry for haven't given you an answer sooner. Lot of work and family affairs ... I've installed the IronPython Package and also selected the 3.7 64 bit Python environment but the warnings still appear. It's very surprising this happens. I believe it might be something related to he .NET framework as they are .NET assemblies. Thank you very much for your help.