简体   繁体   English

在conda环境中看不到pip安装的软件包

[英]Pip installed package not visible in conda environment

I am working in a conda environment (called python36) 我在conda环境中工作(称为python36)

I have installed a package 'bctpy' while in this environment via 我在这个环境中通过以下方式安装了软件包“ bctpy”

pip install bctpy

When I now try to import this module (while still in this environment) 现在,当我尝试导入此模块时(仍在此环境中)

import bctpy  

I receive the error: 我收到错误:

ModuleNotFoundError: No module named 'bctpy'

When I run: 当我跑步时:

conda list 

from the command prompt the module is there, but when in python I run 从命令提示符模块在那里,但是当我在python中运行

help()
modules 

The outputs of which pip and which python are below: 哪个pip和哪个python的输出如下:

(python36) bash-4.1$ which pip
/home/.conda/envs/python36/bin/pip
(python36) bash-4.1$ which python
/home/.conda/envs/python36/bin/python

It is not visible. 它是不可见的。 is anyone able to explain what is going wrong? 有谁能够解释出什么问题了?

This is a problem that one can encounter every now and then: 这是一个时不时会遇到的问题:

The PIP package is derived from the PyPI name bctpy PIP包派生自PyPI名称bctpy

pip install bctpy

but the import name is derived from the top level directory name: bct/ , so it must be imported like 但是导入名称是从顶级目录名称bct/ ,因此必须像导入一样

import bct

Since i could not get it after my pip install ImageHash i tried following 1. Update index in Anaconda 2. Update channel 由于我在pip安装ImageHash之后无法获取它,因此我尝试了以下1.更新Anaconda中的索引2.更新频道

None of them helped. 他们都没有帮助。

but when i went to Anaconda -> Environments tab -> Click on triangle mark next to base(root) -> Open terminal -> ran command conda install -c conda-forge imagehash 但是当我去Anaconda-> Environments选项卡->单击base(root)旁边的三角形标记->打开终端->运行命令conda install -c conda-forge imagehash

Immediately after this i was able to see the package. 此后,我立即看到了包裹。

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

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