Miniconda的点发现错误环境中的要求

时间:2018-11-30 16:23:51

标签: python pip anaconda conda miniconda

我使用conda已有一段时间了,没有太大问题。但是,我只是尝试了以下操作:

# start: fresh login
~$ conda activate nben
(nben) ~$ which pip
~/Library/miniconda2/envs/nben/bin/pip
(nben) ~$ echo $PYTHONPATH #shows my (uninstalled) dev libraries only
/Users/nben/Code/pimms:/Users/nben/Code/neuropythy
(nben) ~$ pip install pybids
Requirement already satisfied: pybids in /Users/nben/Library/miniconda2/envs/winawerlab/lib/python3.6/site-packages (0.6.5)
Requirement already satisfied: six in /Users/nben/Library/miniconda2/envs/winawerlab/lib/python3.6/site-packages (from pybids) (1.11.0)
Requirement already satisfied: grabbit>=0.2.3 in /Users/nben/Library/miniconda2/envs/winawerlab/lib/python3.6/site-packages (from pybids) (0.2.4)
Requirement already satisfied: scipy in /Users/nben/Library/miniconda2/envs/winawerlab/lib/python3.6/site-packages (from pybids) (1.1.0)
... # several more of these
(nben) ~$ python
Python 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 11:07:29) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pybids
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pybids'
>>>

安装在nben环境中的pip正在winawerlab环境中查找需求,即使我直接通过其绝对路径调用它并清除PYTHONPATH也是如此。以前从未发生过这种情况,而且我已经使用这种环境了数周了。我想不到我所做的任何事情都会改变任何环境设置。

我认为env目录中的某些内容可能已开始指向错误的位置,因此我运行了以下内容,但未发现任何内容:

~$ cd ~/Library/miniconda2/envs/nben
~/Library/miniconda2/envs/nben$ grep winawerlab `find ./etc -type f -print`

此外,我只是注意到了这种行为:

(nben) ~$ /Users/nben/Library/miniconda2/envs/nben/bin/pip --version
pip 10.0.1 from /Users/nben/Library/miniconda2/envs/winawerlab/lib/python3.6/site-packages/pip 
(python 3.6)

有人知道会发生什么吗? 预先感谢。

编辑

更多信息增加了混乱:

(nben) ~$ python
Python 3.6.6 |Anaconda custom (64-bit)| (default, Jun 28 2018, 11:07:29) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.executable
'/Users/nben/Library/miniconda2/envs/nben/bin/python'
>>> sys.prefix
'/Users/nben/Library/miniconda2/envs/nben'
>>> sys.exec_prefix
'/Users/nben/Library/miniconda2/envs/nben'
>>> [p for p in sys.path if 'winawerlab' in p]
['/Users/nben/Library/miniconda2/envs/winawerlab/lib/python3.6/site-packages']

以某种方式,winawerlab环境的site-packages目录将其放入我的python实例的sys.path中。在阅读完this question的答案之后,我不得不得出一个结论,那就是唯一可能出现的形式是编译时宏。发生了什么事?

0 个答案:

没有答案