[英]How do I access a function within a virtual environment package on PyCharm
I have my virtual environment set up in PyCharm. 我在PyCharm中设置了虚拟环境。 Typically when I press command-B it takes me to the source function. 通常,当我按Command-B时,它将带我到源功能。 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. 在PyCharm中,确保将项目解释器设置为正确的路径。
Open File > Settings > Project: [name] > Project Interpreter
打开File > Settings > Project: [name] > Project Interpreter
Select your venv
from the dropdown list. 从下拉列表中选择您的venv
。 If it's not there, add one by clicking Add Local
on the bottom of the dropdown. 如果不存在,请通过单击下拉列表底部的“ Add Local
”来Add Local
一个。
You can either select an existing environment path, or create one from the GUI. 您可以选择一个现有的环境路径,也可以从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. 对于使用库rewrite
分支的项目,我有一个virtalenv
,因为它与其他版本不兼容。
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. 当我选择该环境(如果是公共环境)时,可以看到为该特定Python实例安装的所有软件包。
After you select the correct environment, all the packages should show definitions when you CTRL+Click
or use other shortcuts. 选择正确的环境后,当您CTRL+Click
键并CTRL+Click
或使用其他快捷方式时,所有软件包都应显示定义。
See more on PyCharm's documentation for virtual environments. 有关虚拟环境的更多信息,请参见PyCharm的文档。
Adding Existing Virtual Environment: https://www.jetbrains.com/help/pycharm/adding-existing-virtual-environment.html 添加现有虚拟环境: 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 创建虚拟环境: https : //www.jetbrains.com/help/pycharm/creating-virtual-environment.html
Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.