简体   繁体   中英

Pip in pycharm install packages in conda env and not in active venv inside project

i'm having a weird problem...

I can install packages using the built-in package manager in pycharm. But for some reason everytime i use "pip install (xx)" it is installing the packages in a conda env somewhere on my mac...

How can i solve this?

I've tried the following: close --> reopen pycharm // deactivate and activate the venv // Checked project intepreter is the right one (which it is...)

在此处输入图像描述

在此处输入图像描述

You're inside the virtual environment venv , while being inside the Conda base environment (note the (venv) and (base) to the left of your prompt). Conda is likely overriding your venv 's pip .

My bet as to why this is happening is that, during installation, you set Conda to autostart its base environment whenever a new terminal is open (be it inside PyCharm or not).

You can try to either:

    1. exit Conda (with conda deactivate ) and try pip install again (check to see that you're still inside the venv virtual environment).
    1. install the packages directly from PyCharm's GUI - note the small + sign on the bottom-left of the package list. This won't solve the issue related to your terminal, but will function as a workaround for now.

Note that these aren't guaranteed to work, because you may have additional configurations on your system (either installed directly by you, or indirectly by Conda when you installed it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM