I'm trying to extend the HelloWorld example here:
by simply adding this line at the top of HelloWorldCore.swift:
building gives this error:
\SourceCache\swift-build-examples\HelloWorld-CMake\Source\HelloWorldCore\HelloWorldCore.swift:2:8: error: no such module 'Python'
ninja: build stopped: subcommand failed.
I'd installed Visual Studio 2019, including Python (and c++ for native tools)
I then installed Swift “VS2019(Google)” by downloading “installer.exe” from
Without the "import Python" HelloWorld builds fine:
[2/5] Linking C shared library bin\CCore.dll
Creating library lib\CCore.lib and object lib\CCore.exp
[3/5] Linking Swift shared library bin\HelloWorldCore.dll
Creating library lib\HelloWorldCore.lib and object lib\HelloWorldCore.exp
[4/5] Linking Swift executable bin\TestHelloWorldCore.exe
Creating library bin\TestHelloWorldCore.lib and object bin\TestHelloWorldCore.exp
[5/5] Linking Swift executable bin\HelloWorld.exe
Creating library bin\HelloWorld.lib and object bin\HelloWorld.exp
So the general setup and configuration seems to be all there. Not sure what to do to make Python module visible to the compiler/linker. Python is definitely installed as I'm able to type "python" in the same command prompt from which I'm attempting to build, and that works fine by starting the python interpreter.
Wondered what was a good way to make it possible to import Python into Swift 5.3 running on windows. Is Swift “VS2019(Google)” a good choice, or would it be easier to start off by using a different swift installer which might have python more readily integrated? Or perhaps some other suggestions - thanks!