在现有的virtualenv中使用IntellijIdea [英] Using IntellijIdea within an existing virtualenv

查看:154
本文介绍了在现有的virtualenv中使用IntellijIdea的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我现有的python django项目中使用Intellij Idea,该项目是在ubuntu的虚拟环境中构建的。如何配置Intellij Idea以使用虚拟环境的库?

解决方案

对于旧版本:



我解决了上述问题。我已经将virtualenv文件夹的python添加到项目sdk。需要将virtualenv目录的python(例如venv / bin / python2.7)添加到Intellij Idea项目路径中。示例:需要转到文件>项目结构(intellij Idea)



项目SDK 中按新增功能,并添加新的路径到virtualenv的python目录,如下所示:



转到模块>依赖关系,并将您的模块sdk设置为在此标记的Python SDK图片:



点击 Django (在下一个图像中标记选项),并设置 Django项目根设置管理脚本像这样:



现在按OK和项目设置的最终外观:



现在需要运行项目。



对于Pycharm 2016及更高版本



将现有的虚拟环境添加到列表中的可用口译员


  1. 在项目解释器页面中,单击。

  2. 在下拉列表中,选择添加本地


  1. 在打开的选择Python解释器对话框中,选择所需的Python可执行文件,在虚拟环境文件夹内,然后点击确定

转到这个 li nk 获取更多信息。


I want to use Intellij Idea within my existing python django project which was built within a virtual environment in ubuntu. How do I configure Intellij Idea to use the libraries of the virtual environment?

解决方案

For Older versions:

Well I solved the above problem. I have added virtualenv folder's python to project sdk. The virtualenv directory's python( for example venv/bin/python2.7) needs to be added to Intellij Idea project path. Example: need to go to file>project structure (intellij Idea)

press new in Project SDK, and add new path to virtualenv's python directory like this:

Go to Modules>Dependencies and set your module sdk to Python SDK which is marked on this picture:

Click on Django (option marked in next the image) and set Django project root, Settings,Manage Script like this:

Now press ok and final look of the Project settings:

Now need to run the project.

For Pycharm 2016 and later

To add an existing virtual environment to the list of available interpreters

  1. In the Project Interpreter page, click .
  2. In the drop-down list, choose Add local.

  1. In the Select Python Interpreter dialog box that opens, choose the desired Python executable, located inside the virtual environment folder, and click OK.

Go to this link for more information.

这篇关于在现有的virtualenv中使用IntellijIdea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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