简体   繁体   English

使用 pip 安装包

[英]Installing packages with pip

I have been advised using pip in a Anaconda virtual environment is bad.有人建议我在 Anaconda 虚拟环境中使用 pip 是不好的。 But some packages are not on conda or on conda forge.但是有些软件包不在 conda 或 conda forge 上。

When I run当我跑

conda activate virtualenv
where pip

I get two paths, one which is outside the environment我有两条路径,一条在环境之外

C:\Anaconda\virtualenv\Scripts\pip.exe
C:\Anaconda\Scripts\pip.exe

How do I fix it, so that when I do pip install package it only installs in the virtual environment?如何修复它,以便当我执行 pip install package 时它只安装在虚拟环境中?

The command line should use the first pip it finds, which in your case is the one in the virtual environment.命令行应该使用它找到的第一个pip ,在你的情况下是虚拟环境中的那个。 This pip will only install packages in your environment.这个pip只会在你的环境中安装包。 You can check which one is running with pip --version .您可以使用pip --version检查哪个正在运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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