How do you create a PyDev project from existing code?

限于喜欢 提交于 2019-12-23 15:21:00

问题


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...

Is says: 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).

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

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?

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


回答1:


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

  • 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.


来源:https://stackoverflow.com/questions/7394031/how-do-you-create-a-pydev-project-from-existing-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!