打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Creating a Project with PyDev in Eclipse

Creating a Project

Ok, now that your interpreter is configured, it is time to create a project.

After opening Eclipse, go to the menu:
file > new > project > PyDev > PyDev project. You should see the screen below:


Project name: this is the name of the project.

Project contents: where it should be located.

Project type: defines the set of interpreters that will be available for that project.

Grammar version: the grammar used for parsing the files in this project. It doesn't have to match the grammar of the
actual interpreter selected. This is done so that you can use a newer interpreter while having the grammar you use
compatible with an older interpreter (e.g.: using a Python 2.6 interpreter with a Python 2.4 grammar in the project).

Interpreter: Defines which interpreter should be used for code-completion and default run configurations (note that
you can still create a run configuration with a different interpreter).

Create default 'src' folder and add it to the pythonpath: If you don't leave that option checked, you'll have to create
the source folder(s) yourself after the project is created (which is covered in the next tutorial page).

You may finish in this screen or go to the next, where you will be asked which projects are referenced from this one.

Referenced projects

The referenced projects are the projects whose source folders are added to the PYTHONPATH for the
referrer project.

The next tutorial page enters into more details on project references

Creating a Project from existing sources

If you created the project inside Eclipse, you just have to import the project again
(in files > import > general > existing projects into workspace) – it'll look for the existing .project
file and will configure it automatically from the existing configuration.

If you have the sources from an existing project that wasn't created in Eclipse, you have 2 options:

  • Create the project as if it was a new project, but leave the create default 'src' folder option
    unchecked and point the location to the location of the sources (or a level above) – the next tutorial page
    will explain the steps to configure the PYTHONPATH (which should be done after creating the project this way).
  • Create a new project in the default workspace and create a folder that's a link to your existing sources. Note
    that this link folder must be added to the PYTHONPATH in the next step.

Note 1: links can be used above the source folder or as the source folder, but
never inside a source folder, as it's not supported by PyDev)

Note 2: To create the folder as a link, choose the file > new > folder from the menu and in the new folder
dialog select the Advanced >> options.

Note 3: If the file structure you have is:

myproject
.../ _init_.py
.../ module.py

and you want to make the import:

from myproject import module

you have to add to the project the folder above myproject (as the folder above myproject
will be your source folder – as required by Python).

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
M2Eclipse: FAQ
Organize Projects and Solutions
7 Ways to Add JARs to Project Build Paths in Eclipse (Java)
安装openi
eclipse中设置.class文件的输出路径及“java build path”的设置 ...
Maven和Eclipse联合开发
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服