如何将预先存在的python项目导入Eclipse?

时间:2021-07-17 11:04:15

I am using eclipse for python. How do I import an existing project into eclipse in the current workspace.

我正在使用eclipse for python。如何在当前工作空间中将现有项目导入eclipse。

Thanks

10 个解决方案

#1


13  

New Project

Dont use default Location

不要使用默认位置

Browse to existing project location ...

浏览到现有项目位置...

if its an existing eclipse project with project files that have correct paths for your system you can just open the .proj file ...

如果它是一个现有的eclipse项目,项目文件具有正确的系统路径,你可以打开.proj文件...

#2


12  

In my case when i am trying to import my existing perforce project , it gives error no project found on windows machine. On linux i was able to import project nicely.

在我的情况下,当我尝试导入我现有的perforce项目时,它会给出错误,在Windows机器上找不到任何项目。在linux上,我能够很好地导入项目。

For Eclipse Kepler, i have done like below.

对于Eclipse Kepler,我在下面做了类似的事情。

  1. Open eclipse in pydev perspective.
  2. 在pydev透视中打开eclipse。

  3. Create a new pydev project in your eclipse workspace with the same name which project you want to import.
  4. 在eclipse工作区中创建一个新的pydev项目,其名称与要导入的项目相同。

  5. By now in your eclipse workspace project dir , you must be having .project and .pydevproject files.
  6. 到目前为止,在您的eclipse工作区项目目录中,您必须拥有.project和.pydevproject文件。

  7. Copy these two files and paste it to project dir which you want to import.
  8. 复制这两个文件并将其粘贴到要导入的项目目录。

  9. Now close and delete the pydev project you created and delete it from local disk as well.
  10. 现在关闭并删除您创建的pydev项目,并将其从本地磁盘中删除。

  11. Now you can use import utility to import project in eclipse.
  12. 现在您可以使用导入实用程序在eclipse中导入项目。

#3


7  

  • make sure pydev interpreter is added, add otherwise
  • 确保添加了pydev解释器,否则添加

  • windows->preferences->Pydev->Interpreter-Python

  • then create new pydev project,

    然后创建新的pydev项目,

  • give the same name
  • 给出相同的名字

  • then don't use default location, browse to point the project location.
  • 然后不要使用默认位置,浏览指向项目位置。

#4


7  

At time of writing none of the given answers worked.

在撰写本文时,没有一个给定的答案奏效。

This is how it's done:

这就是它的完成方式:

  1. Locate the directory containing the Pydev project
  2. 找到包含Pydev项目的目录

  3. Delete the PyDev project files (important as Eclipse won't let you create a new project in the same location otherwise)
  4. 删除PyDev项目文件(重要的是Eclipse不会让你在同一个位置创建一个新项目)

  5. In Eclipse, File->New->Pydev Project
  6. 在Eclipse中,File-> New-> Pydev Project

  7. Name the project the same as your original project
  8. 将项目命名为与原始项目相同

  9. For project contents, browse to location containing Pydev project
  10. 对于项目内容,浏览到包含Pydev项目的位置

  11. Select an interpreter
  12. 选择一名翻译

  13. Follow rest of the menu through
  14. 按照菜单的其余部分进行操作

Other answers using Eclipse project importing result in Pydev loosing track of packages, turning them all into folders only.

使用Eclipse项目导入的其他答案导致Pydev丢失了包的跟踪,只将它们全部转换为文件夹。

This does loose any project settings previously set, please edit this answer if it can be avoided. Hopefully Pydev devs will add project import functionality some time.

这确实松开了之前设置的任何项目设置,如果可以避免,请编辑此答案。希望Pydev开发人员有时会添加项目导入功能。

#5


3  

Copy these two files from some existing pydev eclipse project to root folder of new project which you want to import in eclipse. .project .pydevproject

将这两个文件从一些现有的pydev eclipse项目复制到你想在eclipse中导入的新项目的根文件夹。 .project .pydevproject

Open .project file in notepad and change name to your_project_name. If you don't have these files then you can create them yourself.

在记事本中打开.project文件,并将名称更改为your_project_name。如果您没有这些文件,那么您可以自己创建它们。

Open eclipse, click File -> Import. New window will open. Now select 'Existing Projects into Workspace' under 'General' and click Next. On new window browse to project root directory and select root folder. Then click finish.

打开eclipse,单击File - > Import。新窗口将打开。现在,在“常规”下选择“现有项目到工作区”,然后单击“下一步”。在新窗口中浏览到项目根目录并选择根文件夹。然后单击完成。

Check this tutorial for complete solution.

查看本教程的完整解决方案。

#6


2  

Following are the steps

以下是步骤

  • Select pydev Perspective
  • 选择pydev Perspective

  • right click on the project pan and click "import"
  • 右键单击项目平移,然后单击“导入”

  • From the list select the existing project into workspace.
  • 从列表中选择现有项目到工作区。

  • Select root directory by going next
  • 下一步选择根目录

  • Optionally you can select to copy the project into
  • 您可以选择将项目复制到

thanks

#7


0  

I just suffered through this problem for a few hours. My issue may have been different than yours...Pydev did not show up as an import option (as opposed to C projects). My solution is to drag and drop. Just create a new project (name it the same as your old) and then drop your old project into the new project folder as displayed in eclipse...3 hours later and it's drag and drop...

我刚刚经历了这个问题几个小时。我的问题可能与你的不同...... Pydev并没有显示为导入选项(而不是C项目)。我的解决方案是拖放。只需创建一个新项目(将其命名为与旧项目相同),然后将旧项目放入eclipse中显示的新项目文件夹中... 3小时后再拖放...

#8


0  

This can easily be done if you keep you project in a git repository. The following is working with Linux but should be ok with Windows as well:

如果您将项目保存在git存储库中,则可以轻松完成此操作。以下是使用Linux,但也适用于Windows:

Clone your project from the repository:

从存储库中克隆您的项目:

git clone https://url/of/project/file.git

(if you don't keep your project on a free git server like github or bitbucket, you can create a new local repository by changing directory into an existing project folder and typing git init)

(如果你没有将你的项目放在像github或bitbucket这样的免费git服务器上,你可以通过将目录更改为现有的项目文件夹并输入git init来创建一个新的本地存储库)

Then open eclipse and go to File > Import > Git > Projects from Git > Existing local repository > (select your project or add it) > Next > Finish

然后打开eclipse并转到文件>导入> Git>项目从Git>现有本地存储库>(选择您的项目或添加它)>下一步>完成

#9


0  

After following steps outlined by @Shan, if the folders under the root folder are not shown as packages,

按照@Shan概述的步骤后,如果根文件夹下的文件夹未显示为包,

  • Right-click on the root folder in PyDev Package Explorer
  • 在PyDev Package Explorer中右键单击根文件夹

  • Select PyDev > Set as source-folder
  • 选择PyDev>设置为源文件夹

It will add the root folder to the PYTHONPATH and now the folders will appear as packages

它会将根文件夹添加到PYTHONPATH,现在文件夹将显示为包

#10


0  

First of all make sure that you have the same Python interpreter configured as the project has. You can change it under:

首先确保您具有与项目配置相同的Python解释器。您可以在以下位置更改它:

Window > Preferences > PyDev > Interpreters > Python Interpreters

Window> Preferences> PyDev> Interpreters> Python Interpreters

As long the project was created using Eclipse you can use import functionality. Go to:

只要项目是使用Eclipse创建的,您就可以使用导入功能。去:

File > Import... > General > Existing Projects into Workspace

文件>导入...>常规>现有项目到工作区

Choose Select root directory: and browse to your project location. Click Finish and you are done.

选择选择根目录:并浏览到您的项目位置。单击完成,您就完成了。

#1


13  

New Project

Dont use default Location

不要使用默认位置

Browse to existing project location ...

浏览到现有项目位置...

if its an existing eclipse project with project files that have correct paths for your system you can just open the .proj file ...

如果它是一个现有的eclipse项目,项目文件具有正确的系统路径,你可以打开.proj文件...

#2


12  

In my case when i am trying to import my existing perforce project , it gives error no project found on windows machine. On linux i was able to import project nicely.

在我的情况下,当我尝试导入我现有的perforce项目时,它会给出错误,在Windows机器上找不到任何项目。在linux上,我能够很好地导入项目。

For Eclipse Kepler, i have done like below.

对于Eclipse Kepler,我在下面做了类似的事情。

  1. Open eclipse in pydev perspective.
  2. 在pydev透视中打开eclipse。

  3. Create a new pydev project in your eclipse workspace with the same name which project you want to import.
  4. 在eclipse工作区中创建一个新的pydev项目,其名称与要导入的项目相同。

  5. By now in your eclipse workspace project dir , you must be having .project and .pydevproject files.
  6. 到目前为止,在您的eclipse工作区项目目录中,您必须拥有.project和.pydevproject文件。

  7. Copy these two files and paste it to project dir which you want to import.
  8. 复制这两个文件并将其粘贴到要导入的项目目录。

  9. Now close and delete the pydev project you created and delete it from local disk as well.
  10. 现在关闭并删除您创建的pydev项目,并将其从本地磁盘中删除。

  11. Now you can use import utility to import project in eclipse.
  12. 现在您可以使用导入实用程序在eclipse中导入项目。

#3


7  

  • make sure pydev interpreter is added, add otherwise
  • 确保添加了pydev解释器,否则添加

  • windows->preferences->Pydev->Interpreter-Python

  • then create new pydev project,

    然后创建新的pydev项目,

  • give the same name
  • 给出相同的名字

  • then don't use default location, browse to point the project location.
  • 然后不要使用默认位置,浏览指向项目位置。

#4


7  

At time of writing none of the given answers worked.

在撰写本文时,没有一个给定的答案奏效。

This is how it's done:

这就是它的完成方式:

  1. Locate the directory containing the Pydev project
  2. 找到包含Pydev项目的目录

  3. Delete the PyDev project files (important as Eclipse won't let you create a new project in the same location otherwise)
  4. 删除PyDev项目文件(重要的是Eclipse不会让你在同一个位置创建一个新项目)

  5. In Eclipse, File->New->Pydev Project
  6. 在Eclipse中,File-> New-> Pydev Project

  7. Name the project the same as your original project
  8. 将项目命名为与原始项目相同

  9. For project contents, browse to location containing Pydev project
  10. 对于项目内容,浏览到包含Pydev项目的位置

  11. Select an interpreter
  12. 选择一名翻译

  13. Follow rest of the menu through
  14. 按照菜单的其余部分进行操作

Other answers using Eclipse project importing result in Pydev loosing track of packages, turning them all into folders only.

使用Eclipse项目导入的其他答案导致Pydev丢失了包的跟踪,只将它们全部转换为文件夹。

This does loose any project settings previously set, please edit this answer if it can be avoided. Hopefully Pydev devs will add project import functionality some time.

这确实松开了之前设置的任何项目设置,如果可以避免,请编辑此答案。希望Pydev开发人员有时会添加项目导入功能。

#5


3  

Copy these two files from some existing pydev eclipse project to root folder of new project which you want to import in eclipse. .project .pydevproject

将这两个文件从一些现有的pydev eclipse项目复制到你想在eclipse中导入的新项目的根文件夹。 .project .pydevproject

Open .project file in notepad and change name to your_project_name. If you don't have these files then you can create them yourself.

在记事本中打开.project文件,并将名称更改为your_project_name。如果您没有这些文件,那么您可以自己创建它们。

Open eclipse, click File -> Import. New window will open. Now select 'Existing Projects into Workspace' under 'General' and click Next. On new window browse to project root directory and select root folder. Then click finish.

打开eclipse,单击File - > Import。新窗口将打开。现在,在“常规”下选择“现有项目到工作区”,然后单击“下一步”。在新窗口中浏览到项目根目录并选择根文件夹。然后单击完成。

Check this tutorial for complete solution.

查看本教程的完整解决方案。

#6


2  

Following are the steps

以下是步骤

  • Select pydev Perspective
  • 选择pydev Perspective

  • right click on the project pan and click "import"
  • 右键单击项目平移,然后单击“导入”

  • From the list select the existing project into workspace.
  • 从列表中选择现有项目到工作区。

  • Select root directory by going next
  • 下一步选择根目录

  • Optionally you can select to copy the project into
  • 您可以选择将项目复制到

thanks

#7


0  

I just suffered through this problem for a few hours. My issue may have been different than yours...Pydev did not show up as an import option (as opposed to C projects). My solution is to drag and drop. Just create a new project (name it the same as your old) and then drop your old project into the new project folder as displayed in eclipse...3 hours later and it's drag and drop...

我刚刚经历了这个问题几个小时。我的问题可能与你的不同...... Pydev并没有显示为导入选项(而不是C项目)。我的解决方案是拖放。只需创建一个新项目(将其命名为与旧项目相同),然后将旧项目放入eclipse中显示的新项目文件夹中... 3小时后再拖放...

#8


0  

This can easily be done if you keep you project in a git repository. The following is working with Linux but should be ok with Windows as well:

如果您将项目保存在git存储库中,则可以轻松完成此操作。以下是使用Linux,但也适用于Windows:

Clone your project from the repository:

从存储库中克隆您的项目:

git clone https://url/of/project/file.git

(if you don't keep your project on a free git server like github or bitbucket, you can create a new local repository by changing directory into an existing project folder and typing git init)

(如果你没有将你的项目放在像github或bitbucket这样的免费git服务器上,你可以通过将目录更改为现有的项目文件夹并输入git init来创建一个新的本地存储库)

Then open eclipse and go to File > Import > Git > Projects from Git > Existing local repository > (select your project or add it) > Next > Finish

然后打开eclipse并转到文件>导入> Git>项目从Git>现有本地存储库>(选择您的项目或添加它)>下一步>完成

#9


0  

After following steps outlined by @Shan, if the folders under the root folder are not shown as packages,

按照@Shan概述的步骤后,如果根文件夹下的文件夹未显示为包,

  • Right-click on the root folder in PyDev Package Explorer
  • 在PyDev Package Explorer中右键单击根文件夹

  • Select PyDev > Set as source-folder
  • 选择PyDev>设置为源文件夹

It will add the root folder to the PYTHONPATH and now the folders will appear as packages

它会将根文件夹添加到PYTHONPATH,现在文件夹将显示为包

#10


0  

First of all make sure that you have the same Python interpreter configured as the project has. You can change it under:

首先确保您具有与项目配置相同的Python解释器。您可以在以下位置更改它:

Window > Preferences > PyDev > Interpreters > Python Interpreters

Window> Preferences> PyDev> Interpreters> Python Interpreters

As long the project was created using Eclipse you can use import functionality. Go to:

只要项目是使用Eclipse创建的,您就可以使用导入功能。去:

File > Import... > General > Existing Projects into Workspace

文件>导入...>常规>现有项目到工作区

Choose Select root directory: and browse to your project location. Click Finish and you are done.

选择选择根目录:并浏览到您的项目位置。单击完成,您就完成了。