如何从现有代码创建PyDev项目? [英] How do you create a PyDev project from existing code?

查看:102
本文介绍了如何从现有代码创建PyDev项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个Python项目,该项目开始在TextPad和命令提示符中进行开发.

I have created a python project which I began development in TextPad and Command Prompt.

http://pydev.org/manual_101_project_conf.html

本文档简要提到了使用现有代码创建项目,但我无法理解...

This documentation briefly mentions creating a project with existing code, but I can't make sense of it...

是说: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).

这很有意义,所以我创建了一个新项目并选择了 Don't configure PYTHONPATH (to be done manually later on)

which makes enough sense, so I created a new project and selected Don't configure PYTHONPATH (to be done manually later on)

一切都很好,很有意义.因此,您可以导航到下一页,据说该页面会说出如何配置PYTHONPATH,这应以某种方式使该项目包含src文件???

All fine, makes enough sense. So you can navigate to the next page where supposedly it says how to configure the PYTHONPATH, which should somehow make this project contain the src files???...

http://pydev.org/manual_101_project_conf2.html

假定此链接包含从现有代码创建项目的信息.它说明了如何轻松创建源文件...因此,我将现有代码带入并复制到源文件夹中?

Supposedly this link contains information to create the project from the existing code. It says how to create a source file, easy enough... So I take me existing code and copy it into the source folder?

这很好,我现在可以在src文件夹中运行我的模块,但是它提到我应该将其添加到PYTHONPATH中.如果我的文件按预期运行,为什么需要这样做?这有什么目的?

Well this works well enough, I can now run my modules inside the src folder, but it mentions I should add it to the PYTHONPATH. If my files are running as expected why do I need to do this? What purpose does that serve?

在此过程中我还缺少什么吗?到目前为止,该文档让我感到困惑...寻找基础知识,任何信息都很棒

Is there anything else I'm missing in this process? The documentation just confuses me so far... Looking for the basics, any information would be awesome

推荐答案

根据我的经验,在PyDev中配置PYTHONPATH具有两个主要兴趣:

From my experience, configuring the PYTHONPATH in PyDev has two main interests :

  • 一个明显的例子,如果您有多个包含模块的文件夹,它允许运行在 a 文件夹中的代码将模块导入到 b
  • 文件夹中
  • 另一件事是,PyDev似乎依赖于此来实现某些部分的代码补全以及代码分析;不属于PYTHONPATH一部分的python来源未启用此最后一个有用的功能.
  • an obvious one if you have multiple folders containing modules, it allows code running in folder a to import modules in folder b
  • another one, is that PyDev seems to rely on this to enable some parts of code completion, and also code analysis ; this last useful feature is not enabled for python sources that are not part of the PYTHONPATH.

这篇关于如何从现有代码创建PyDev项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆