简体   繁体   English

从Eclipse迁移到PyCharm:将项目(其文件夹)添加到python路径

[英]Moving from Eclipse to PyCharm: Adding a project (its folder) to the python path

My apologies in advance if I am not very clear (I am still programming in a rather childlish way). 如果我不太清楚,我会事先道歉(我仍然以相当幼稚的方式进行编程)。

I am trying to move from Eclipse to PyCharm (community version) and so far no issues with the editor or cloning from github. 我正在尝试从Eclipse迁移到PyCharm(社区版本),到目前为止,编辑器或从github克隆都没有问题。 However I am having doubts on how to use classes and modules from an external project: 但是我对如何使用外部项目中的类和模块有疑问:

In Eclipse I would go to: Windows -> Preferences -> Interpreter -> Python Interpreter and over here add new folder, which would be the subfolder within Eclipse "workspace" folder where I am saving the project. 在Eclipse中,我将转到: Windows -> Preferences -> Interpreter -> Python Interpreter然后在此处添加新文件夹,该文件夹将是我保存项目的Eclipse“ workspace”文件夹中的子文件夹。

In PyCharm I am using File -> Preferences -> Project: Project_Name1 and over here I have the possibility to mark as sources (or excluded) all the project folders I want. 在PyCharm中,我使用File -> Preferences -> Project: Project_Name1 ,在这里,我可以将我想要的所有项目文件夹标记为源(或排除)。

This brings me many doubts... 这给我带来了很多疑问...

  1. I imported several repositories (my own) from github and I set the option to keep open in the same window as the first (this option is new compared with eclipse but it gives me the same output with all the project within the package explorer). 我从github导入了几个存储库(我自己的),并设置了在第一个窗口中保持打开状态的选项(与eclipse相比,此选项是新的,但对于包资源管理器中的所有项目,它都提供相同的输出)。

    However, when I got to File -> Preferences -> Project: Only the first project appears independently which one I have selected. 但是,当我进入“ File -> Preferences -> Project:只有第一个项目独立出现,是我选择的那个项目。 How can I modify the interpreter and/or dependencies for the rest? 如何修改其余的解释器和/或依赖项?

  2. If I add a project folder to the project structure do I also need to modify the project dependencies? 如果将项目文件夹添加到项目结构,是否还需要修改项目依赖项?

Incidentally any guide or tutorial on the right so it imports are not broken with each new IDE or when the code is shared would be most welcomed. 顺便说一句,最右边的任何指南或教程都不会受到每个新IDE的破坏,或者在共享代码时不会受到干扰。

我的PyCharm屏幕截图 Here is a view of my Setting: 这是我的设置的视图:

It Shows only the name of first project, but when you go to each setting under the project, the setting is shown for all the projects. 它仅显示第一个项目的名称,但是当您转到该项目下的每个设置时,将显示所有项目的设置。 When I go under Project Interpreter for example, I can choose the Interpreter for each project separately: 例如,当我进入Project Interpreter时,可以为每个项目分别选择Interpreter:

第二截图

Is it different for you? 您觉得与众不同吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM