Installing Packages with Pip in Anaconda Environments
Creating and activating conda environments allows for isolated Python installations for specific projects. However, users may encounter issues when attempting to install packages using pip within Anaconda environments.
A common problem is that pip attempts to install packages into the system-wide Python installation instead of the active environment. To resolve this issue, follow these steps:
1. Create and activate the Anaconda environment.
conda create -n shrink_venv source activate shrink_venv
2. Install pip within the environment.
conda install pip
3. Locate the environment directory
This directory is typically located at /anaconda/envs/venv_name/.
4. Install packages using the environment's pip:
Execute the following command:
/anaconda/envs/venv_name/bin/pip install package_name
By following these steps, pip will successfully install packages specifically within the active Anaconda environment, solving the issue of installing packages in the system-wide Python installation.
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3