简体   繁体   English

Conda:软件包已通过pip安装,但未在conda列表中显示

[英]Conda: packages are already installed by pip but not shown in conda list

I use pip install packages in a conda environment. 我在conda环境中使用pip安装软件包。

pip install pygame
Requirement already satisfied: pygame in ./anaconda3/lib/python3.6/site-packages (1.9.4)

where the current directory is /Users/aptx4869 . 当前目录为/Users/aptx4869 However, when I type conda list , there is nothing in the current environment. 但是,当我键入conda list ,当前环境中什么也没有。 What's wrong with it? 它出什么问题了? Here's the directory where the environment is at 这是环境所在的目录

/Users/aptx4869/anaconda3/envs/rl

Update 更新

I delete the pygame in the root environment and run pip install pygame in the rl conda environment, I receive another message. 我在根环境中删除pygame ,并在rl conda环境中运行pip install pygame ,我收到了另一条消息。 But pygame still doesn't show in conda list 但是pygame仍然没有显示在conda list

 pip install pygame
Collecting pygame
  Using cached https://files.pythonhosted.org/packages/bc/19/57bf1e9c72be4f7afc1add56cc717b7f7fe8ef1b6b5fb58f031a06401d0f/pygame-1.9.4-cp36-cp36m-macosx_10_11_intel.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.4
(rl)

Notice (rl) in the end, this pip command still installs pygame in the root environment 最后注意(rl) ,此pip命令仍将pygame安装在根环境中

I guess that you installed the pygame package into the root environment when you run pip install pygame the first time. 我猜您是在第一次运行pip install pygame时将pygame软件包安装到了根环境中。 So make sure that you have activated the environment into which you want to install packages and then use pip to install the packages. 因此,请确保已激活要在其中安装软件包的环境,然后使用pip来安装软件包。 Doing this, you should see the packages in the list of conda list command. 这样做,您应该在conda list命令列表中看到软件包。 Also, you must run the conda list command in the same environment where you run pip install . 另外,必须在运行pip install的相同环境中运行conda list命令。

原因仅仅是因为我没有在dl环境中安装python和pip,而conda在我命令pip install ...在根环境中隐式使用python和pip pip install ...

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

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