import python to Xcode | Apple Developer Forums (2024)

Table of Contents
Accepted Reply Replies

You’re now watching this thread. If you’ve opted in to email or web notifications, you’ll be notified when there’s activity. Click again to stop watching or visit your profile to manage watched threads and notifications.

You’ve stopped watching this thread and will no longer receive emails or web notifications when there’s activity. Click again to start watching.

having a little hiccup. Basically SS show the issue im havingimport python to Xcode | Apple Developer Forums (1)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 developmentOpen 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!

"

  • Xcode

Up vote post of lac_ekim Down vote post of lac_ekim

4.8k views

Posted by

import python to Xcode | Apple Developer Forums (2) lac_ekim

Share this post

Copied to Clipboard

Reply

I am also having this issue

Add a Comment

Accepted Reply

import python to Xcode | Apple Developer Forums (3)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

Up vote reply of lac_ekim Down vote reply of lac_ekim

Post marked as solved

Add a Comment

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

Posted by

import python to Xcode | Apple Developer Forums (5) letMyNameEqualM

Share this post

Copied to Clipboard

Up vote reply of letMyNameEqualM Down vote reply of letMyNameEqualM

Add a Comment

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.

See Also
Android JS

had to improvise a little because "go to add package" was not there. I took the chance of choosing this one.import python to Xcode | Apple Developer Forums (6)

nextimport python to Xcode | Apple Developer Forums (7)

next

import python to Xcode | Apple Developer Forums (8)

next

import python to Xcode | Apple Developer Forums (9)

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

import python to Xcode | Apple Developer Forums (10)

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.

Posted by

import python to Xcode | Apple Developer Forums (11) lac_ekim

Share this post

Copied to Clipboard

Up vote reply of lac_ekim Down vote reply of lac_ekim

Add a Comment

import python to Xcode | Apple Developer Forums (12)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

Posted by

import python to Xcode | Apple Developer Forums (13) lac_ekim

Share this post

Copied to Clipboard

Up vote reply of lac_ekim Down vote reply of lac_ekim

Post marked as solved

Add a Comment

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.

Posted by

import python to Xcode | Apple Developer Forums (14) lac_ekim

Share this post

Copied to Clipboard

Up vote reply of lac_ekim Down vote reply of lac_ekim

Add a Comment

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

import python to Xcode | Apple Developer Forums (15)

import python to Xcode | Apple Developer Forums (16)

Posted by

import python to Xcode | Apple Developer Forums (17) lac_ekim

Share this post

Copied to Clipboard

Up vote reply of lac_ekim Down vote reply of lac_ekim

Add a Comment

import python to Xcode  | Apple Developer Forums (2024)
Top Articles
Latest Posts
Article information

Author: Errol Quitzon

Last Updated:

Views: 5557

Rating: 4.9 / 5 (59 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Errol Quitzon

Birthday: 1993-04-02

Address: 70604 Haley Lane, Port Weldonside, TN 99233-0942

Phone: +9665282866296

Job: Product Retail Agent

Hobby: Computer programming, Horseback riding, Hooping, Dance, Ice skating, Backpacking, Rafting

Introduction: My name is Errol Quitzon, I am a fair, cute, fancy, clean, attractive, sparkling, kind person who loves writing and wants to share my knowledge and understanding with you.