简体   繁体   English

如何在PyCharm上的虚拟环境包中访问功能

[英]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.

相关问题 如何使用PyCharm和Anaconda创建虚拟环境? - How do I create a virtual environment using PyCharm and Anaconda? 如何使用 PyCharm 激活我的虚拟环境? 我什至可以在 PyCharm 中激活它吗? - How do I activate my virtual environment using PyCharm? Can I even activate it in PyCharm? 如何在虚拟环境中使用系统安装的python软件包? - How can I use a system installed python package within a virtual environment? 当我已经安装了python 3.6时,如何在运行python(和pipenv)2.7的pycharm中设置虚拟环境? - How do I set up a virtual environment in pycharm which runs python (and pipenv) 2.7 when I already have python 3.6 installed? 如何在Pycharm中为Django创建虚拟环境? - How to create a virtual environment for Django in Pycharm? 如何在Powershell 2中激活虚拟环境? - How do I activate a virtual environment in Powershell 2? 如何设置 python 虚拟环境? - How do I setup a python virtual environment? 在虚拟环境 pycharm MAC 中安装 SHAP package 时出错 - Error installing SHAP package in virtual environment pycharm MAC 如何在虚拟环境中找到我的Django安装? - How do I find my Django install within my virtual environment? 如何将软件包二进制文件安装到虚拟环境中 - How do you install a package binary into a virtual environment
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM