Help us shape Visual Studio 2019 for Mac! By supporting installation of both versions of the product side-by-side, we’ll make it easy for you to try out the Visual Studio 2019 for Mac preview releases while we are still also working on the stable Visual Studio 2017 for Mac releases in parallel. Aug 22, 2018. About how to setup python development environment with Visual Studio Code. This article is written on the perspective of a Mac OS users,.
17 Apr 2016CPOL
How to configure Visual Studio code to work with Python3
Introduction
I love Visual Studio Code, really – it’s the longest lasting fav thing I’ve had, like, for evah! … I used to hack on Sublime, but I deleted it last week (for evah) in favor of vs code … it's the business.
Anyway, my love for it aside – I was starting some R&D the other day using it, and couldn’t get the darn thing to play nice with the latest version of Python. Using V2, no hassle, but V3 … nope … and dig as I might, I couldn’t find what settings to change. I reached out to @code who sent me to the wiki that kinda helped, but not quite…
Configure VS Code for Python3
After a lot of poking around and going down rabbit holes, I found the solution, you need to tweak the tasks.json file to tell it to use Python V3.
To get to that file, in vscode (mac) cmd+shift+P – type ‘
task
’ – select ‘configure task runner
’, and edit the file to point the “command
” at “python3
”, and the (command line) args to point at ${file}
. Save, Debug/Run .. works! … now, back to coding. :)History
- V1 - 17th April, 2016
Answers
- Short answer, don't think you'll find an answer here, you can't.Xamarin is all about using c# and f# in a cross platform environment. Yes you can bind to native objective c or Java libraries, but only on the local platform (not cross platform), to use Xamarin you need a c# equivalent of your Python libraryHth
- @AndyFlisher Thank you for quick response can't I use ironpython to achieve this or please suggest me a better component
Thanks - Honestly don't know, quick glance is that Iron Python allows you to use .net apis in Python, not the other way. Xamarin lets you use existing .net dlls, and PCL's as well as extending to allows Objective C and Java bindings. So if IronPython can compile down to a C# dll then you're laughing, if not then the two are tantalisingly close, but will never quite meet I think
- edited July 2015I just tried to install IronPython in a Xamarin project. The install failed, with a message that it was not compatible. No explanation as to why.
- @WilliamJockusch Yes that won't work because of this we moved on to Android studio ,disappointing that even Xamarin is not giving a proper solution for this. Please let me know if you find any workaround .
- I might be missing a trick here, so please explain, but why would Iron Python work inside a Xamarin Project. Xamarin projects are written in C#, Iron Python in Python so how would the Xamarin / Mono compiler understand it?You could possibly compile a dll from Xamarin and use that in an Iron Python project, maybe, or have I misunderstood how Iron Python works?
- @AndyFlisher Im trying to use a math library which is written in python and if I write a wrapper around this math library same can be used for all mobile platforms with Xamarin.
- So does this wrapper compile down the python to a .net library, as that's what Xamarin uses?
- No we are not compiling python to .net library , Basically I want to run python files in device
e.g. Hello.py //keep this in asset folder
print('Hello world!');
output should be Hello World in device screen - Ok, but don't understand how this applies to Xamarin. Xamarin apps are written in C#, with .net libraries as extensions, so not sure how you would expect a .py file to work / compile / or in anyway understood by a C# compiler?In fact, in a Xamarin.Android sense it specifically states that this won't work http://developer.xamarin.com/guides/android/advanced_topics/limitations/) - am guessing you have an inkling that this should in somehow work but over my head, have you tried at the Iron Python Forums?
- Yes because of these limitation we scraped Xamarin and we are developing for individual platforms
- At least part of the problem is a conflict between IronPython and Apple's rules. Specifically, Apple forbids real-time code generation, but IronPython requires it.
- I'm really, really confused, why do you consider it a limitation of Xamarin (a C# based platform) that it can't handle Python libraries? C# != Python, to my knowledge Xamarin has never claimed to be anything other than C# (F# as it's cousin), .net libraries, and native bindings. Python (Iron or otherwise) doesn't fit, it's a different language! I've asked the question about 3 or 4 times in this thread, and not seeing an answer, why do you think Python would work in Xamarin?Not wanting to be confrontational, I genuinely don't understand, once I do then I or someone better might be able to help, but right now am confused and not entirely sure it's fair calling this a limitation of Xamarin?
- At least part of the problem is a conflict between IronPython and Apple's rules. Specifically, Apple forbids real-time code generation, but IronPython requires it.That side I can understand, which is why Xamarin pre-compiles, C#, but not Python. There's a theoretical maybe for some really basic stuff on Android but not sure it's worth the pain
- I'm late to the party here ... Xamarin Studio is not the same as VS.NET .. shared .net dlls yes but Xamarin can't handle python.. Visual Studio does , it supports using Python API's directly in C# code 'Using IronPython.Hosting;'
Which Combined with the Xamarin Add on, works well ..