Skip to content

Setting up an environment in Visual Studio

Mathijs Dumon edited this page Jan 4, 2019 · 3 revisions
  • First Clone PyXRD source code:

    • In visual studio go to "View > Team Explorer" in the menu
    • In the Team Explorer view, you'll have a section called 'local git repositories'
    • Click on 'Clone' and paste the Github repository url for pyxrd (https://github.com/PyXRD/PyXRD.git)
    • Choose where you want to put the source code
    • Press 'Clone'
  • Then create a new visual studio project:

    • Go to "File > New > New Project"
    • Select Python > From Existing Python Code
    • Give it a proper name, and select the location where you cloned the PyXRD sources - make sure it is the root folder containing the pyxrd and mvc folders
    • In the Wizard just click Finish
  • Then add a new Python environment pointing to the python that came with the PyXRD bundle installer (solves some issues as GTK is not readily available on windows)

    • Open the Solution Explorer ("View > Solution Explorer" in case it's closed)

    • Right click Python Environments and select "View All Python Environments"

    • Scroll down in the top list of environments untill you find the " + Custom..." button and click it

    • Enter the following:

      Description = PyXRDPython Prefix path = C:\Program Files (x86)\PyXRD\lib\python3.6 Interpreter path = C:\Program Files (x86)\PyXRD\bin\python3.exe Windowed interpreter = C:\Program Files (x86)\PyXRD\bin\python3w.exe Language version = 3.6 Architecture = 32-bit Path env. variable = PYTHONPATH

    • Then click Apply

  • Go back to the solution explorer

    • Right click Python Evironments again and select Add/Remove Python Environments
    • In the dialog select only the PyXRDPython environment we just created
  • Finally set the startup file:

    • In the solution explorer navigate to pyxrd > main.py
    • Right click and select "Set as startup file"

You're all ready to run the code.