Python with eclipse ide

Настраиваем Python в Eclipse и пишем Hello World!

В предыдущей заметке были рассмотрены только дистрибутивы Linux, где Python поставляется «из коробки» и есть замечательный редактор gedit , в котором можно редактировать скрипты.

Однако пока еще не все перешли на Linux 😉

Кроме того, для разработки на Python удобно использовать полноценную IDE. Eclipse — кросплатформенная среда разработки, поэтому рассмотрим его настройку как в Windows, так и в Linux. Eclipse распространяется под свободной лицензией EPL.

Постараюсь описать все максимально подробно. Если будут вопросы — задавайте в комментариях.

Установка интерпретатора Python в Windows

Скачиваем последнюю версию Python 2.7.x для Windows с официального сайта: . На момент написания это версии:

Нужно скачивать последнюю версию в ветке 2.7, то есть 2.7.3, 2.7.4, 2.7.5…

Читайте также:  Java criteria predicate and

Устанавливаем интерпретатор Python в директорию C:\Python2.7 .

Устанавливаем Eclipse

Скачиваем версию Eclipse IDE for Java Developers (или Classic) для нужной операционной системы и разрядности (32-бита/64-бита) с официального сайта: .

Установка очень простая — распаковываем содержимое архива в C:\eclipse , либо в /home/username/eclipse и запускаем исполняемый файл eclipse.exe ( eclipse в Linux).

Устанавливаем PyDev

PyDev () — плагин для работы с Python в Eclipse.

Eclipse: Help - Install New Software.

Выбираем Help — «Install New Software…»:

Window: Add Repository

Нажимаем «Add…». Появляется диалоговое окно: В поле Name пишем: «Pydev and Pydev Extensions», в поле Location: «http://pydev.org/updates». Нажимаем «OK».

Window: Install New Software - Pydev

Ставим галочку напротив «Pydev for Eclipse» и нажимаем «Next».

Eclipse Window: Review Licenses

Изучаем лицензию. Если лицензия подходит, помечаем «I accept the terms of the license agreement» и нажимаем «Finish».

Pydev установлен. Перезапускаем Eclipse.

Создаем проект ‘Hello World’

Eclipse menu: New - Project.

Нажимаем правой кнопкой мыше в пространстве Package Explorer, выбираем New—Project…:

Eclipse Window: New Project

Выбираем «Pydev Project» и нажимаем «Next»:

Eclipse Window: Create a new Pydev Project

На следующей странице: Project Name: «Hello World», нажимаем ссылку: «Please configure an interpreter in the related preferences before proceeding.».

Eclipse Window: Python Interpreters

Появляется окно настройки интерпретаторов Python:

Eclipse Window: Add new python interpreter

В появившемся диалоговом окне: В поле Interpreter Name пишем «Python 2.x», где x — установленная версия интерпретатора Python. В поле Interpreter Executable выбираем путь к исполняемому файлу Python.

Для Windows здесь будет: C:\Python2.7\python.exe , если был установлен интерпретатор Python 2.7 в директорию «C:\Python2.7».

Для Linux это: /usr/bin/python — для системной версии Python (для начала этот вариант подойдет), /usr/local/bin/python2.7 — для версии Python, установленной вручную.

Eclipse: Select Python Libs

Eclipse: Python Interpreters - Added

Eclipse: Pydev perspective

Eclipse: New - Pydev Module

В «Pydev Package Explorer» нажимаем правой кнопкой на директорию \src и выбираем в появившемся меню: New—Pydev Module:

Eclipse: Create new Pydev Module

В поле Name пишем «helloworld» и нажимаем «Finish».

Eclipse: Python Hello World

Создаем программу «Hello World», описанную в предыдущей заметке:

Eclipse: How to run Python Script

Запускаем скрипт (меню: Run — Run, Ctrl-F11):

Eclipse: Hello World result in Console

И видим результат в Console:

Вот и все! Теперь можно переходить к более серьезным скриптам.

Настраиваем Python в Eclipse и пишем Hello World! : 34 комментария

Источник

Пишем на Python в Eclipse

Для поддержки языка программирования Python в Eclipse нужно установить PyDev. Для этого открываем Marketplace:

Eclipse Marketplace

В строке поиска наберите “Python” и нажмите клавишу Enter. В списке кликаем “Install” у пункта “PyDev — Python IDE for Eclipse”:

Installing PyDev Python IDE for Eclipse from Karketplace

Дальше прокликиваем все остальные окошки, со всем соглашаемся. На странице с лицензионным соглашением ставим переключатель на “I accept the terms of the license agreements”. Перезапускаем Eclipse, как нам и предлагают.

При запуске у вас появится сообщение, что Python не настроен. Кликаем мышкой на “Manual config”:

It seems that the Python interpreter is not currently configured. How do you want to proceed?

Открывается вот такое окно:

Python interpreters

Теперь нам нужно установить интерпретатор Python. Как это делается под Linux я уже рассказывал вот в этой статье. Под Windows же нам нужно скачать установщик с официального сайта. После установки возвращаемся в Eclipse и выбираем установленный Python. У меня он по умолчанию установился по пути:

Источник

Python with eclipse ide

Submitted by Ramiro Arias on Tue, 2023-05-09 18:27

Hi
I have Eclipse 2022-12 (4.26). I went to marketplace and asked for PyDev. It appears as «PyDev — Python IDE for Eclipse 10.1.4». I proceed to install. Then I clicked on Confirm. Then the following message appeared: «The following solutions are not available: PyDev — Python IDE for Eclipse 10.1.4» Proceed with the installation anyways? Of course I clicked No. How can I install PyDev then?

Re: PyDev not available for Eclipse 2022-12 (4.26.0)

Submitted by Scott Case on Thu, 2023-06-15 13:48

I had the same error until I unselected the optional «mylyn» item before continuing — so only the single required pydev option was selected.

Pydev not available in eclipse 10.0.1

Submitted by Shivamdeep Garg on Thu, 2022-12-08 04:38

When i try to install pydev on eclipse 2022-09 or 2022-06. I’m getting the error — Pydev not available in eclipse 10.0.1. Even if I install python editor is not working fine.

PyDev in Eclipse 4.24 prevents double-clicking to open Java file

Submitted by Maxwell Ma on Fri, 2022-06-17 15:43

In Eclipse 4.24, if PyDev is installed, it is not possible to open Java files in Project Explorer using double click or F3. And the right-click menu will also have problems, the 3 menu items copy, paste, delete will appear 2 times.

Re: PyDev in Eclipse 4.24 prevents double-clicking to open Java

Submitted by Maxwell Ma on Fri, 2022-06-17 15:50

To add:
macOS 11.6.7
New Eclipse(eclipse-jee-2022-06-R-macosx-cocoa-x86_64.dmg) and new workspace
Only pydev was installed, and during installation «pydev mylyn integration» was not installed because of unmet dependencies.

Regarding version of eclipse

Submitted by Amritpal Singh on Sat, 2019-11-09 09:52

Which eclipse version supports python live coding

pydev does not support eclipse 4.13

Submitted by Longyi Gu on Wed, 2019-10-02 03:16

when does pydev support eclipse 4.13?

Re: pydev does not support eclipse 4.13

Submitted by Fabio Zadrozny on Wed, 2019-10-02 10:13

It should actually be supported already. I’ve just updated the listing (the other times the marketplace did this automatically, not sure why this didn’t happen this time around).

Submitted by Roger Duthie on Fri, 2018-07-06 04:44

How can users report broken features?

Are any of the other links in this description broken?

Submitted by Fabio Zadrozny on Fri, 2018-07-06 08:08

Sorry about that. Just updated the link (should be: https://www.brainwy.com/tracker/PyDev/)

Thank you!

Submitted by Trevor Robertson on Tue, 2018-03-13 08:27

Easy interface; Formatting of code a highlight. Still my first choice.

Wow. Huge improvements

Submitted by Tim Richardson on Fri, 2016-04-15 22:17

I normally use Pycharm but I decided to have a look at Pydev again in eclipse 4.5.2.
Wow. pydev is really good. Pycharm has lots of added value features like managing the python interpreter modules etc, but for coding and debugging pydev is good. It seems so much slicker now, good inspections, debugging, code completion.

Error with scroll when open file if you install in Eclipse Mars

Submitted by Quan Vu on Tue, 2016-04-05 02:46

I get a error with scroll bar when I install PyDev plugin in eclipse mars.
I recommend you íntall PyDev in eclipse luna. The eclipse luna very stability

Won’t install on Eclipse Mars

Submitted by Chris Nasr on Mon, 2015-10-19 09:58

I tried dragging it from this page, and I tried finding it in the market place, either way I get the same error:

Unable to read repository at dl.bintray.com/fabioz/pydev/latest/content.xml.
java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

Re: Won’t install on Eclipse Mars

Submitted by Fabio Zadrozny on Tue, 2016-02-16 10:54

The problem is that the update site: https://dl.bintray.com/fabioz/pydev/latest is no longer valid. Remove that one and use http://www.pydev.org/updates/ instead.

Issue in Eclipse?

Submitted by Fabio Zadrozny on Tue, 2016-01-12 12:26

This is really weird, Eclipse shouldn’t ask for content.xml, but content.jar, which is there. (I just tested it and it worked for me).

As that didn’t work, try following the instructions from http://www.pydev.org/download.html (and use http://www.pydev.org/updates as the update site) or use LiClipse (http://www.liclipse.com) which has PyDev preinstalled.

I want to like this a lot.

Submitted by Nir Friedman on Wed, 2015-05-06 16:35

As Eclipse is already my tool of choice for C++, and I really enjoy many other Eclipse plugins, I really wanted to like this plugin. Unfortunately, PyDev just pales next to the Community Edition of PyCharm. I could probably ignore the extra functionality if PyDev had comparable type inference, but it does not. I also filed a bug against the tracker, which was confusing compare to more modern trackers, and I haven’t heard anything back.

Type inference

Submitted by Fabio Zadrozny on Fri, 2015-05-08 09:20

Источник

Оцените статью