如何在PyCharm上的虚拟环境包中访问函数 [英] How do I access a function within a virtual environment package on PyCharm

查看:268
本文介绍了如何在PyCharm上的虚拟环境包中访问函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在PyCharm中建立了我的虚拟环境。通常,当我按下命令B时,它会将我带到源函数。这不会把我带入我的虚拟环境软件包/那个源代码函数中。

解决方案

在PyCharm中,项目解释器设置为正确的路径。



打开文件>设置>项目:[名称]> Project Interpreter





选择您的从下拉列表中选择 venv 。如果不存在,请点击下拉底部的添加本地



您可以选择一个现有的环境路径,或从GUI创建一个。



选择您的环境后,确保列出所有您需要的软件包。



例如,在上面的屏幕截图中,您可以看到我安装的全局包。对于使用库的 rewrite 分支的项目,我有一个 virtalenv ,因为它与其他版本不兼容。 p>

当我选择该环境时(如果它是公共的),我可以看到为特定的Python实例安装的所有软件包。





当您选择正确的环境后,当< c> CTRL +单击或使用其他快捷方式。



请参阅PyCharm有关虚拟环境的文档。 b $ b

添加现有虚拟环境: https://www.jetbrains.com/help/pycharm/adding-existing-virtual-environment.html



创建虚拟环境: https:// www .jetbrains.com / help / pycharm / creating-virtual-environment.html



祝您好运!


I have my virtual environment set up in PyCharm. Typically when I press command-B it takes me to the source function. This is not taking me into my virtual environment packages / that source function.

解决方案

In PyCharm, make sure that your project interpreter is set to the correct path.

Open File > Settings > Project: [name] > Project Interpreter

Select your venv from the dropdown list. If it's not there, add one by clicking Add Local on the bottom of the dropdown.

You can either select an existing environment path, or create one from the GUI.

Once your environment is selected, make sure all of the packages you need are listed.

For example, in the above screenshot you can see the global packages I have installed. I have a virtalenv for projects that use the rewrite branch of a library, because it's incompatible with other versions.

When I select that environment (if it's a public one), I can see all of the packages I have installed for that specific Python instance.

After you select the correct environment, all the packages should show definitions when you CTRL+Click or use other shortcuts.

See more on PyCharm's documentation for virtual environments.

Adding Existing Virtual Environment: https://www.jetbrains.com/help/pycharm/adding-existing-virtual-environment.html

Creating a Virtual Environment: https://www.jetbrains.com/help/pycharm/creating-virtual-environment.html

Good luck!

这篇关于如何在PyCharm上的虚拟环境包中访问函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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