如何在 PyCharm 中正确设置 pipenv? [英] How do I properly setup pipenv in PyCharm?
问题描述
我在一个项目中需要 krakenex,所以我用
I need krakenex in a project, so I import it with
import krakenex
我有一个版本的 krakenex
I have one version of krakenex in
/Users/x/Library/Python/3.6/lib/python/site-packages
/Users/x/Library/Python/3.6/lib/python/site-packages
.当我执行脚本和
print(krakenex)
它向我展示了上面提到的路径.
it shows me the path mentioned above.
将来,我想使用我安装的软件包中的模块,例如
In the future, I want to use the modules from the packages I installed with e.g.
pipenv install krakenex
优先.
我如何设法做到这一点?把虚拟环境的路径加到sys路径就够了,还是有更优雅的方式?
How do I manage to do that? Is it sufficient to add the path of the virtual environment to the sys path, or is there a more elegant way?
推荐答案
您应该将您的项目解释器指向 virtualenv python bin.因此,在 PyCharm File->Settings->Project: ProjectName->Project Interpreter 中,应该会显示一个显示 Project Interpreter 的窗口.
You should be pointing your Project Interpreter to the virtualenv python bin. So in PyCharm File->Settings->Project: ProjectName->Project Interpreter, then a windows showing the Project Interpreter should be displayed.
顶部下拉列表旁边是一个齿轮,您将想要添加本地并导航到 virtualenvs python bin.类似于 virtualenvs/virtualenv_name/bin/python
.那么你的项目应该指向正确的地方.
Next to the top dropdown is a gear and your going to want to Add Local and navigate to the virtualenvs python bin. Something like virtualenvs/virtualenv_name/bin/python
. Then your project should be pointing to the right place.
这篇关于如何在 PyCharm 中正确设置 pipenv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!