How do you create a PyDev project from existing co

2019-06-24 03:47发布

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条回答
劳资没心,怎么记你
2楼-- · 2019-06-24 04:26

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.
查看更多
登录 后发表回答