Beginning a new programming language can be a challenge. This tutorial will go through how to set up python on a Mac ( Windows users can go here). There are many schools of thought on the âbestâ development environments, IDEâs, etc to work with. The goal of this article is to help you get up and running on a Mac writing Python using the Sublime Text IDE. Sublime Text is a simple IDE/text editor that can be used with a number of languages, including Python.
1. Download & Install Sublime Text
Visit http://www.sublimetext.com/2, and press the OS X button. When the download is complete, open the downloaded dmg file, and move the program to your applications folder.
Microsoft word remove border from text box. 2. Setup Local Environment
Usually you can just select python from Tools>Build System>Python and hit Ctrl+B to run it in the sublime console. However if you need to provide inputs in your program then you need to make some changes. I have installed Python 3.3 via the installer obtained from python.org and installed Sublime Stack Exchange Network Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers. Mac command for crossing out text.
Once you have installed Sublime Text, you can open it from your Applications folder, and add it to your dock. As you learn more about Python and programming in general, you will need to become familiar with the command line. There are some tools packaged with Sublime Text that can make your life a lot easier. One of these is the ability to open files and Sublime itself from the command line. To start, search Spotlight in the upper right-hand corner of your Mac for a program called âTerminalâ. This program is an extremely useful tool for a variety of things, including running Python programs.
From Terminal, we will set up a folder using the command âmkdirâ. This command produces the same result as the âNew Folderâ option you might be familiar with from Finder. Type âmkdir binâ from Terminal. If you type âlsâ (show folders and files), you should see âbinâ listed. The full path of this is ~/bin, which we will use in a moment.
Sublime Text 3 Python Packages
To use the bin folder in Terminal in the future, we will need to be able to access it in our Terminalâs profile. The profile is essentially a list of places that terminal can look for running programs and using core system tools. To add to your path, type:
![]()
This should open a file that contains commands that show where to look. Press the down arrow to the bottom of the file. Type âiâ. You should now be able to insert text into the file. Type the following below the last line:
This tells Terminal to look for the bin folder you created within its profile. To save the file, press escape, type â:wqâ, then press enter. The file has been saved, but to use the new profile, we also need to tell terminal to use the latest version. To do this, type:
3. Allow Terminal to use the Sublime command line tools directly
What is mac command for center text. To setup the command line tools offered with Sublime Text, we will be creating a âsymbolic linkâ using Terminal. The command for this is ln -s . We will be using the Sublime Text app as the first file, and creating a link to that in the âbinâ folder we just created. This symbolic link will allow us to access Sublime using the command âsublâ from the command line. To do this, type the following in Terminal:
How To Configure Sublime Text For Python
or
Sublime Text 3 Download MacThis tutorial outlined how to set up a Python IDE on a Mac, and how to set up a Python file to run from the exact version of Python you want it to, every time. Python is a great language with many features, and youâve learned a few wayss to get up and running using Python on a Mac. Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |