简体   繁体   English

conda和pip在不同的路径

[英]Conda and pip are in different paths

I installed miniforge on my Mac M1 and created an environment.我在我的 Mac M1 上安装了 miniforge 并创建了一个环境。

conda create --name myenv
conda activate myenv

In this environment, I installed python and pip. There are some packages specifically available on pip, so I did a pip install -r requirements.txt , assuming that these packages would be dumped in the myenv environment.在这个环境中,我安装了 python 和 pip。有一些包专门在 pip 上可用,所以我做了一个pip install -r requirements.txt ,假设这些包会被转储到 myenv 环境中。

However, when I do conda list , I am getting only pip as the installed package and pip list is giving me all the installed packages.但是,当我执行conda list时,我只得到 pip,因为已安装的 package 和pip list为我提供了所有已安装的软件包。

When I checked the path, my conda environment is in this path -当我检查路径时,我的 conda 环境在这个路径中 -

~/miniforge3/envs/myenv/bin/python ~/miniforge3/envs/myenv/bin/python

while my pip is in而我的 pip 在

/Users/I323017/Library/Python/3.8/lib/python/site-packages/pip /Users/I323017/Library/Python/3.8/lib/python/site-packages/pip

Could you please help me to create my pip env under the conda environment by default.你能帮我在conda环境下默认创建我的pip env吗?

I was finally able to fix the issue.我终于能够解决这个问题。

When I do just pip install <package_name> within my environment, the package still gets installed in当我在我的环境中执行pip install <package_name>时,package 仍然安装在

/Users/I323017/Library/Python/3.8/lib/python/site-packages/pip /Users/I323017/Library/Python/3.8/lib/python/site-packages/pip

However, if I do python -m pip install <package_name> within my environment, the package will get installed under the environment directory.但是,如果我在我的环境中执行python -m pip install <package_name> ,package 将安装在环境目录下。

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

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