import python to Xcode

having a little hiccup. Basically SS show the issue im having I then tried to dig on this and came up empty. Here the link [https://developer.apple.com/forums/thread/128049] I was trying this from a playground and after it didn't work I did what the link was saying and that didn't work ether "Got this from github and seems to work.

"How to use Xcode IDE for Python development Open Xcode and start with creating a new project: From the templates, choose Cross-platform > External Build System Give it a name. You can update Organizatin Name and Identifier if you want. Make sure you enter a correct path for Python bin. For Python 3.x it's usually  /usr/bin/pythonw . Click Next and save it. Open scheme editor, select Run from the left hand pane, and Info tab from the detail pane. From Executable menu, select Other... and navigate to where your Python executable binary is locate. That's the same location you entered in step 4, e.g.  /usr/bin/pythonw . You can also use **** + Command + G and paste the address in the dialog box. Uncheck Debug executable box. Still in Run menu, select Arguments tap, and add a new entry to Arguments Passed on Launch. This is the name of the file where you'll write your Python code in it. You'll create the file later. Still in Run menu, select Options tab, and check the box for Use custom working directory. Enter the path to the directory where you have saved your project. Close scheme editor. In Xcode navigation pane, under your project, add a new file. Select Empty from the templates. Make sure the target is check and that you save the file in the same directory where the project file is located. Now you can start writing Python code: Run it!

"

Accepted Reply

tried to test it. Tried it with python kit and python. python was able to pass the first part but the print function still had a issue

Replies

Hi try this:

Python is installed following the steps below:

  1. Open Xcode -> open a new project -> choose macOS -> choose a template -> name it - save it.

  2. Open file -> go to add package -> type in the search box “http://github.com/pvieito/PythonKit.git”

  3. Install PythonKit

  4. Highlight project name -> press command n -> type in the search box playground -> choose macOS -> choose a template - name it - save it.

  5. The playground document now will recognize import PythonKit

  6. import PythonKit

ok, have a few questions about this. FYI ty for taking the time to help. I will put up each pic showing what im doing and the questions I have. if im doing something wrong, let me now lol.

had to improvise a little because "go to add package" was not there. I took the chance of choosing this one.

next

next

next

next on here it shows, I think, its only going to work within this project, not on a playground.

Im fine with that only working within that project. If I can't use the playgrounds to do it, that's fine I guess. Is there a better org for coding like visual studios or something along those lines? TY for the help, I really appreciate it.

tried to test it. Tried it with python kit and python. python was able to pass the first part but the print function still had a issue

ok, I figured out how to open a playground in that project. Put the code in it to see if that did something but It didn't. I just wanted to be sure I attempted everything you stated the way you stated it. yes there were a few things that differed like swift packages. but I believe I have tried what you said to try. Asyou can see im still having issues with it and I have tried everything I can think of.

this was copied directly off https://github.com/pvieito/PythonKit