- Как скачать и установить Python на Mac OC X
- Какая версия python установлена по умолчанию
- Установка Xcode и Homebrew
- Установка Python 3 на MAC OC X
- [Бонус] Первый код в IDLE python для новичков
- Download the latest source release
- Download the latest version of Python
- Active Python Releases
- Looking for a specific release?
- Sponsors
- Licenses
- Sources
- Alternative Implementations
- History
- Release Schedules
- Information about specific ports, and developer info
- OpenPGP Public Keys
- Other Useful Items
- Want to contribute?
Как скачать и установить Python на Mac OC X
Это краткий туториал покажет вам, как правильно установить Python 3 на Mac OS X. Существует несколько способов установки Python 3, включая скачивание с [официального сайта Python] (https://www.python.org/downloads/), однако я настоятельно рекомендую вместо этого использовать менеджер пакетов, такой как Homebrew для управления всеми вашими зависимостями в будущем. Это сделает вашу жизнь намного проще.
Какая версия python установлена по умолчанию
Хотя Python 2 установлен по умолчанию на компьютерах Apple, Python 3 — нет. Вы можете проверить это, набрав в Терминале python —version и нажав return:
Чтобы проверить, установлен ли Python 3, попробуйте запустить команду python3 —version . Скорее всего, вы увидите сообщение об ошибке, но стоит проверить. Даже если у вас есть версия Python 3, мы обновим ее до самой последней версии, которая на данный момент в 2019 году 3.7.2.
Установка Xcode и Homebrew
Мы будем использовать менеджер пакетов Homebrew для установки Python 3 — это общая практика. Homebrew необходим пакет Xcode Apple, поэтому для его установки выполните следующую команду:
Нажимайте далее или подтвердить (Xcode — большая программа, ее установка может занять некоторое время).
Далее установите Homebrew:
Чтобы проверить правильность установки Homebrew, выполните следующую команду:
Установка Python 3 на MAC OC X
Чтобы скачать и установить последнюю версию Python, выполните следующую команду:
Подождите пока установятся все зависимости и сам python 3
Теперь давайте подтвердим, какая версия установилась:
Что бы писать код Python 3 из командной строки, введите python3:
Если вы хотите выйти, введите exit() и return или Ctrl-D (одновременно клавиши Control и D).
Что бы запустить оболочку Python 2, просто вводите python :
[Бонус] Первый код в IDLE python для новичков
Теперь Python 3 установлен на ваш Mac, пора приступить к конкретному написанию первого кода. В Python большинство команд основано на контекстных словах в английском языке. Если в C# потребовалось бы ввести команду Console.WriteLine , чтобы вывести запись на экран, в Python это простая команда print .
Я покажу 3 простые задачи, которые есть в каждом коде:
- вывод данных
- операция сложения
- использование условного оператора if
Для нашей первой задачи мы будем использовать IDLE. Это простой редактор кода, поставляется вместе с Python при его установке. Воспользуйтесь поиском и откройте IDLE.
Откроется окно, которое мы называем “оболочкой”. Там отображается результат выполнения кода, но писать код мы будем отдельно. Для этого нам нужно создать новый файл. Мы можем сделать это, нажав File > New File в верхнем меню. Откроется новый пустой файл.
Сохраните файл. Выберите File > Save As , затем сохраните его как helloworld.py . Обычно, в качестве первой программы используют вывод «Hello World» на экран.
Команда, которую мы собираемся использовать, является командой вывода данных в оболочку. Эта команда выглядит следующим образом. В скобках в кавычках находится текст, который мы выведем на экран.
После того, как вы ввели этот код в файл , выберите File > Save в меню, чтобы сохранить обновленную программу, а затем нажмите Run > Run Module из меню. Ваш вывод появится в окне оболочки. Это должно выглядеть примерно так.
Попробуйте распечатать разные фразы на экране, чтобы привыкнуть к коду.
Наша вторая задача — заставить Python считать за нас. Создайте новый файл Calculation.py. На этот раз мы выведем результат сложения двух чисел. Прибавим 9 к 8, для этого нам нужно ввести в наш новый файл команду print , которая выглядит следующим образом.
Как только вы это сделаете, нужно сохранить и затем запустить программу, нажав Run > Run Module . В оболочке появится результат вычислений, вот так:
Попробуйте различные вычисления, чтобы привыкнуть, помните, что вокруг чисел не нужны кавычки. Если вы еще не знакомы с операторами python, рекомендую прочить эту статью.
Наконец, мы создадим еще одну базовую программу, которая будет выводить результат в зависимости от входных данных, с помощью оператора if . Давайте снова откроем новый файл и выпишем следующий синтаксис:
Здесь мы объявляем переменную my_number равную 100, затем создаем конструкцию if-else , чтобы проверить, больше ли my_number числа 50. Если утверждение верно, мы получим «Это большое число», в противном случае мы увидим «Это небольшое число». ». Не забудьте сохранить и запустить программу, как вы это делали в предыдущих примерах.
Вы заметите, что программа печатает «Это большое число», потому что наш номер превышает 50. Попробуйте поменять номер и посмотрите, какой результат получите. Например, что выведет скрипт, если my_number = 50 ?
Источник
Download the latest source release
Download the latest version of Python
Looking for Python with a different OS? Python for Windows, Linux/UNIX, macOS, Other
Want to help test development versions of Python? Prereleases, Docker images
Looking for Python 2.7? See below for specific releases
Active Python Releases
- 3.10 bugfix 2021-10-04 2026-10 PEP 619
- 3.9 bugfix 2020-10-05 2025-10 PEP 596
- 3.8 security 2019-10-14 2024-10 PEP 569
- 3.7 security 2018-06-27 2023-06-27 PEP 537
- 3.6 security 2016-12-23 2021-12-23 PEP 494
- 2.7 end-of-life 2010-07-03 2020-01-01 PEP 373
Looking for a specific release?
Python releases by version number:
- Python 3.10.0 Oct. 4, 2021 DownloadRelease Notes
- Python 3.7.12 Sept. 4, 2021 DownloadRelease Notes
- Python 3.6.15 Sept. 4, 2021 DownloadRelease Notes
- Python 3.9.7 Aug. 30, 2021 DownloadRelease Notes
- Python 3.8.12 Aug. 30, 2021 DownloadRelease Notes
- Python 3.9.6 June 28, 2021 DownloadRelease Notes
- Python 3.8.11 June 28, 2021 DownloadRelease Notes
- Python 3.7.11 June 28, 2021 DownloadRelease Notes
- Python 3.6.14 June 28, 2021 DownloadRelease Notes
- Python 3.9.5 May 3, 2021 DownloadRelease Notes
- Python 3.8.10 May 3, 2021 DownloadRelease Notes
- Python 3.9.4 April 4, 2021 DownloadRelease Notes
- Python 3.8.9 April 2, 2021 DownloadRelease Notes
- Python 3.9.2 Feb. 19, 2021 DownloadRelease Notes
- Python 3.8.8 Feb. 19, 2021 DownloadRelease Notes
- Python 3.6.13 Feb. 15, 2021 DownloadRelease Notes
- Python 3.7.10 Feb. 15, 2021 DownloadRelease Notes
- Python 3.8.7 Dec. 21, 2020 DownloadRelease Notes
- Python 3.9.1 Dec. 7, 2020 DownloadRelease Notes
- Python 3.9.0 Oct. 5, 2020 DownloadRelease Notes
- Python 3.8.6 Sept. 24, 2020 DownloadRelease Notes
- Python 3.5.10 Sept. 5, 2020 DownloadRelease Notes
- Python 3.7.9 Aug. 17, 2020 DownloadRelease Notes
- Python 3.6.12 Aug. 17, 2020 DownloadRelease Notes
- Python 3.8.5 July 20, 2020 DownloadRelease Notes
- Python 3.8.4 July 13, 2020 DownloadRelease Notes
- Python 3.7.8 June 27, 2020 DownloadRelease Notes
- Python 3.6.11 June 27, 2020 DownloadRelease Notes
- Python 3.8.3 May 13, 2020 DownloadRelease Notes
- Python 2.7.18 April 20, 2020 DownloadRelease Notes
- Python 3.7.7 March 10, 2020 DownloadRelease Notes
- Python 3.8.2 Feb. 24, 2020 DownloadRelease Notes
- Python 3.8.1 Dec. 18, 2019 DownloadRelease Notes
- Python 3.7.6 Dec. 18, 2019 DownloadRelease Notes
- Python 3.6.10 Dec. 18, 2019 DownloadRelease Notes
- Python 3.5.9 Nov. 2, 2019 DownloadRelease Notes
- Python 3.5.8 Oct. 29, 2019 DownloadRelease Notes
- Python 2.7.17 Oct. 19, 2019 DownloadRelease Notes
- Python 3.7.5 Oct. 15, 2019 DownloadRelease Notes
- Python 3.8.0 Oct. 14, 2019 DownloadRelease Notes
- Python 3.7.4 July 8, 2019 DownloadRelease Notes
- Python 3.6.9 July 2, 2019 DownloadRelease Notes
- Python 3.7.3 March 25, 2019 DownloadRelease Notes
- Python 3.4.10 March 18, 2019 DownloadRelease Notes
- Python 3.5.7 March 18, 2019 DownloadRelease Notes
- Python 2.7.16 March 4, 2019 DownloadRelease Notes
- Python 3.7.2 Dec. 24, 2018 DownloadRelease Notes
- Python 3.6.8 Dec. 24, 2018 DownloadRelease Notes
- Python 3.7.1 Oct. 20, 2018 DownloadRelease Notes
- Python 3.6.7 Oct. 20, 2018 DownloadRelease Notes
- Python 3.5.6 Aug. 2, 2018 DownloadRelease Notes
- Python 3.4.9 Aug. 2, 2018 DownloadRelease Notes
- Python 3.7.0 June 27, 2018 DownloadRelease Notes
- Python 3.6.6 June 27, 2018 DownloadRelease Notes
- Python 2.7.15 May 1, 2018 DownloadRelease Notes
- Python 3.6.5 March 28, 2018 DownloadRelease Notes
- Python 3.4.8 Feb. 5, 2018 DownloadRelease Notes
- Python 3.5.5 Feb. 5, 2018 DownloadRelease Notes
- Python 3.6.4 Dec. 19, 2017 DownloadRelease Notes
- Python 3.6.3 Oct. 3, 2017 DownloadRelease Notes
- Python 3.3.7 Sept. 19, 2017 DownloadRelease Notes
- Python 2.7.14 Sept. 16, 2017 DownloadRelease Notes
- Python 3.4.7 Aug. 9, 2017 DownloadRelease Notes
- Python 3.5.4 Aug. 8, 2017 DownloadRelease Notes
- Python 3.6.2 July 17, 2017 DownloadRelease Notes
- Python 3.6.1 March 21, 2017 DownloadRelease Notes
- Python 3.4.6 Jan. 17, 2017 DownloadRelease Notes
- Python 3.5.3 Jan. 17, 2017 DownloadRelease Notes
- Python 3.6.0 Dec. 23, 2016 DownloadRelease Notes
- Python 2.7.13 Dec. 17, 2016 DownloadRelease Notes
- Python 3.4.5 June 27, 2016 DownloadRelease Notes
- Python 3.5.2 June 27, 2016 DownloadRelease Notes
- Python 2.7.12 June 25, 2016 DownloadRelease Notes
- Python 3.4.4 Dec. 21, 2015 DownloadRelease Notes
- Python 3.5.1 Dec. 7, 2015 DownloadRelease Notes
- Python 2.7.11 Dec. 5, 2015 DownloadRelease Notes
- Python 3.5.0 Sept. 13, 2015 DownloadRelease Notes
- Python 2.7.10 May 23, 2015 DownloadRelease Notes
- Python 3.4.3 Feb. 25, 2015 DownloadRelease Notes
- Python 2.7.9 Dec. 10, 2014 DownloadRelease Notes
- Python 3.4.2 Oct. 13, 2014 DownloadRelease Notes
- Python 3.3.6 Oct. 12, 2014 DownloadRelease Notes
- Python 3.2.6 Oct. 12, 2014 DownloadRelease Notes
- Python 2.7.8 July 2, 2014 DownloadRelease Notes
- Python 2.7.7 June 1, 2014 DownloadRelease Notes
- Python 3.4.1 May 19, 2014 DownloadRelease Notes
- Python 3.4.0 March 17, 2014 DownloadRelease Notes
- Python 3.3.5 March 9, 2014 DownloadRelease Notes
- Python 3.3.4 Feb. 9, 2014 DownloadRelease Notes
- Python 3.3.3 Nov. 17, 2013 DownloadRelease Notes
- Python 2.7.6 Nov. 10, 2013 DownloadRelease Notes
- Python 2.6.9 Oct. 29, 2013 DownloadRelease Notes
- Python 3.2.5 May 15, 2013 DownloadRelease Notes
- Python 3.3.2 May 15, 2013 DownloadRelease Notes
- Python 2.7.5 May 12, 2013 DownloadRelease Notes
- Python 3.2.4 April 6, 2013 DownloadRelease Notes
- Python 3.3.1 April 6, 2013 DownloadRelease Notes
- Python 2.7.4 April 6, 2013 DownloadRelease Notes
- Python 3.3.0 Sept. 29, 2012 DownloadRelease Notes
- Python 3.2.3 April 10, 2012 DownloadRelease Notes
- Python 2.6.8 April 10, 2012 DownloadRelease Notes
- Python 3.1.5 April 9, 2012 DownloadRelease Notes
- Python 2.7.3 April 9, 2012 DownloadRelease Notes
- Python 3.2.2 Sept. 3, 2011 DownloadRelease Notes
- Python 3.2.1 July 9, 2011 DownloadRelease Notes
- Python 2.7.2 June 11, 2011 DownloadRelease Notes
- Python 3.1.4 June 11, 2011 DownloadRelease Notes
- Python 2.6.7 June 3, 2011 DownloadRelease Notes
- Python 2.5.6 May 26, 2011 DownloadRelease Notes
- Python 3.2.0 Feb. 20, 2011 DownloadRelease Notes
- Python 3.1.3 Nov. 27, 2010 DownloadRelease Notes
- Python 2.7.1 Nov. 27, 2010 DownloadRelease Notes
- Python 2.6.6 Aug. 24, 2010 DownloadRelease Notes
- Python 2.7.0 July 3, 2010 DownloadRelease Notes
- Python 3.1.2 March 20, 2010 DownloadRelease Notes
- Python 2.6.5 March 18, 2010 DownloadRelease Notes
- Python 2.5.5 Jan. 31, 2010 DownloadRelease Notes
- Python 2.6.4 Oct. 26, 2009 DownloadRelease Notes
- Python 2.6.3 Oct. 2, 2009 DownloadRelease Notes
- Python 3.1.1 Aug. 17, 2009 DownloadRelease Notes
- Python 3.1.0 June 26, 2009 DownloadRelease Notes
- Python 2.6.2 April 14, 2009 DownloadRelease Notes
- Python 3.0.1 Feb. 13, 2009 DownloadRelease Notes
- Python 2.5.4 Dec. 23, 2008 DownloadRelease Notes
- Python 2.5.3 Dec. 19, 2008 DownloadRelease Notes
- Python 2.4.6 Dec. 19, 2008 DownloadRelease Notes
- Python 2.6.1 Dec. 4, 2008 DownloadRelease Notes
- Python 3.0.0 Dec. 3, 2008 DownloadRelease Notes
- Python 2.6.0 Oct. 2, 2008 DownloadRelease Notes
- Python 2.3.7 March 11, 2008 DownloadRelease Notes
- Python 2.4.5 March 11, 2008 DownloadRelease Notes
- Python 2.5.2 Feb. 21, 2008 DownloadRelease Notes
- Python 2.5.1 April 19, 2007 DownloadRelease Notes
- Python 2.3.6 Nov. 1, 2006 DownloadRelease Notes
- Python 2.4.4 Oct. 18, 2006 DownloadRelease Notes
- Python 2.5.0 Sept. 19, 2006 DownloadRelease Notes
- Python 2.4.3 April 15, 2006 DownloadRelease Notes
- Python 2.4.2 Sept. 27, 2005 DownloadRelease Notes
- Python 2.4.1 March 30, 2005 DownloadRelease Notes
- Python 2.3.5 Feb. 8, 2005 DownloadRelease Notes
- Python 2.4.0 Nov. 30, 2004 DownloadRelease Notes
- Python 2.3.4 May 27, 2004 DownloadRelease Notes
- Python 2.3.3 Dec. 19, 2003 DownloadRelease Notes
- Python 2.3.2 Oct. 3, 2003 DownloadRelease Notes
- Python 2.3.1 Sept. 23, 2003 DownloadRelease Notes
- Python 2.3.0 July 29, 2003 DownloadRelease Notes
- Python 2.2.3 May 30, 2003 DownloadRelease Notes
- Python 2.2.2 Oct. 14, 2002 DownloadRelease Notes
- Python 2.2.1 April 10, 2002 DownloadRelease Notes
- Python 2.1.3 April 9, 2002 DownloadRelease Notes
- Python 2.2.0 Dec. 21, 2001 DownloadRelease Notes
- Python 2.0.1 June 22, 2001 DownloadRelease Notes
Sponsors
Visionary sponsors like Google help to host Python downloads.
Licenses
All Python releases are Open Source. Historically, most, but not all, Python releases have also been GPL-compatible. The Licenses page details GPL-compatibility and Terms and Conditions.
Sources
For most Unix systems, you must download and compile the source code. The same source code archive can also be used to build the Windows and Mac versions, and is the starting point for ports to all other platforms.
Download the latest Python 3 and Python 2 source.
Alternative Implementations
This site hosts the «traditional» implementation of Python (nicknamed CPython). A number of alternative implementations are available as well.
History
Python was created in the early 1990s by Guido van Rossum at Stichting Mathematisch Centrum in the Netherlands as a successor of a language called ABC. Guido remains Python’s principal author, although it includes many contributions from others.
Release Schedules
Information about specific ports, and developer info
OpenPGP Public Keys
Source and binary executables are signed by the release manager or binary builder using their OpenPGP key. Release files for currently supported releases are signed by the following:
Release files for older releases which have now reached end-of-life may have been signed by one of the following:
- Anthony Baxter (key id: 0EDD C5F2 6A45 C816)
- Georg Brandl (key id: 0A5B 1018 3658 0288)
- Martin v. Löwis (key id: 6AF0 53F0 7D9D C8D2)
- Ronald Oussoren (key id: C9BE 28DE E6DF 025C)
- Barry Warsaw (key ids: 126E B563 A74B 06BF, D986 6941 EA5B BD71, and ED9D77D5)
You can import a person’s public keys from a public keyserver network server you trust by running a command like:
or, in many cases, public keys can also be found at keybase.io. On the version-specific download pages, you should see a link to both the downloadable file and a detached signature file. To verify the authenticity of the download, grab both files and then run this command:
Note that you must use the name of the signature file, and you should use the one that’s appropriate to the download you’re verifying.
- (These instructions are geared to GnuPG and Unix command-line users.)
Other Useful Items
- Looking for 3rd party Python modules? The Package Index has many of them.
- You can view the standard documentation online, or you can download it in HTML, PostScript, PDF and other formats. See the main Documentation page.
- Information on tools for unpacking archive files provided on python.org is available.
- Tip: even if you download a ready-made binary for your platform, it makes sense to also download the source. This lets you browse the standard library (the subdirectory Lib) and the standard collections of demos (Demo) and tools (Tools) that come with it. There’s a lot you can learn from the source!
- There is also a collection of Emacs packages that the Emacsing Pythoneer might find useful. This includes major modes for editing Python, C, C++, Java, etc., Python debugger interfaces and more. Most packages are compatible with Emacs and XEmacs.
Want to contribute?
Want to contribute? See the Python Developer’s Guide to learn about how Python development is managed.
Источник