Using IntellijIdea within an existing virtualenv(在现有的 virtualenv 中使用 IntellijIdea)
问题描述
我想在我现有的 python django 项目中使用 Intellij Idea,该项目是在 ubuntu 的虚拟环境中构建的.如何配置 Intellij Idea 以使用虚拟环境的库?
对于 PyCharm 2018
根据来自 Pycharm 的 .
- 在打开的选择 Python 解释器"对话框中,选择位于虚拟环境文件夹中的所需 Python 可执行文件,然后单击确定.
转到此链接了解更多信息信息.
<小时>对于旧版本:
好吧,我解决了上述问题.我已将 virtualenv 文件夹的 python 添加到项目 sdk 中.需要将 virtualenv 目录的 python(例如 venv/bin/python2.7)添加到 Intellij Idea 项目路径中.示例:需要进入文件>项目结构(intellij Idea)
在 Project SDK 中按 new,然后将新路径添加到 virtualenv 的 python 目录,如下所示:
转到 Modules>Dependencies 并将您的模块 sdk 设置为在此图片上标记的 Python SDK:
点击Django(下图中标记的选项)并设置Django project root
、Settings
、Manage Script代码> 像这样:
现在按 ok 并最终查看项目设置:
现在需要运行项目.
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 PyCharm 2018
As per documentation from Pycharm:
- In the Project Interpreter page, click and select Add.
In the left-hand pane of the Add Python Interpreter dialog box, select Virtualenv Environment. The following actions depend on whether the virtual environment existed before.
If Existing environment is selected:
- Specify the required interpreter: use the drop-down list, or click Select an interpreter and find one in your file system.
- Select the check-box Make available to all projects, if needed.
Click OK to complete the task.
For Pycharm 2016 and later
To add an existing virtual environment to the list of available interpreters
- In the Project Interpreter page, click .
- In the drop-down list, choose Add local.
- 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.
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.
这篇关于在现有的 virtualenv 中使用 IntellijIdea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在现有的 virtualenv 中使用 IntellijIdea


基础教程推荐
- 修改列表中的数据帧不起作用 2022-01-01
- 无法导入 Pytorch [WinError 126] 找不到指定的模块 2022-01-01
- Plotly:如何设置绘图图形的样式,使其不显示缺失日期的间隙? 2022-01-01
- 包装空间模型 2022-01-01
- 使用大型矩阵时禁止 Pycharm 输出中的自动换行符 2022-01-01
- 求两个直方图的卷积 2022-01-01
- PANDA VALUE_COUNTS包含GROUP BY之前的所有值 2022-01-01
- 在同一图形上绘制Bokeh的烛台和音量条 2022-01-01
- PermissionError: pip 从 8.1.1 升级到 8.1.2 2022-01-01
- 在Python中从Azure BLOB存储中读取文件 2022-01-01