Linux Conda 使用activate無法進入環境,但list中有環境的路徑

Jushi發表於2023-02-24

安裝OpenFace時裝了個miniconda,之後就進不去anaconda的其它環境了:

(pfld) 。。。。。$ conda env list
# conda environments:
#
                         /home/deeplearning/anaconda3/home/deeplearning/anaconda3/envs/common/home/deeplearning/anaconda3/envs/openface
                         /home/deeplearning/anaconda3/envs/pfld
                         /home/deeplearning/anaconda3/envs/public_env
                         。。。。。。
base                     /home/deeplearning/miniconda3
pfld                  *  /home/deeplearning/miniconda3/envs/pfld

(pfld) 。。。。。$ conda activate public_env

EnvironmentNameNotFound: Could not find conda environment: public_env
You can list all discoverable environments with `conda info --envs`.

 

仔細看,左邊這列的"base",指向miniconda,anaconda的環境都沒了名字。說明當前正在miniconda中。

這時需要透過"activate [anaconda的環境路徑]"和"source activate"回到anaconda:

(pfld) 。。。。。。$ conda activate /home/deeplearning/anaconda3
(/home/deeplearning/anaconda3) 。。。。。。$ source activate
(/home/deeplearning/anaconda3) 。。。。。。$ conda env list
# conda environments:
#
base                  *  /home/deeplearning/anaconda3
common                   /home/deeplearning/anaconda3/envs/common
openface                 /home/deeplearning/anaconda3/envs/openface
pfld                     /home/deeplearning/anaconda3/envs/pfld
public_env               /home/deeplearning/anaconda3/envs/public_env/home/deeplearning/miniconda3
                         /home/deeplearning/miniconda3/envs/pfld

可以看見anaconda環境的名字都回來了,而miniconda的環境名都消失了,這時便可以使用"conda activate <env_name>"跳轉到anaconda的環境。

 

openface並不一定要miniconda,所以可以把它卸了:解除安裝miniconda

 

參考:conda環境名消失的解決辦法

 

附:openface安裝步驟

Step 1.

  Install miniconda with the following commands wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh bash Miniconda3-latest-Linux-x86_64.sh and follow instructions. 

  Add a Python 2.7 environment with: conda create --name openface python=2.7 

  Activate the new env with: source activate openface

Step 2.

  Install dependencies Add the conda-forge channel with: conda config --add channels conda-forge conda install opencv numpy pandas scipy scikit-learn scikit-image dlib txaio twisted autobahn OpenSSL pyopenssl imagehash service_identity

Step 3.

  Install Torch and dependencies Deactivate the openface environment by opening a new terminal. git clone https://github.com/torch/distro.git ~/torch --recursive cd ~/torch; bash install-deps; ./install.sh *

  Execute the following to install the Torch deps for NAME in dpnn nn optim optnet csvigo cutorch cunn fblualib torchx tds; do luarocks install $NAME; done

Step 4.

  Install open face in openface environment using source activate openface git clone https://github.com/cmusatyalab/openface.git ~/openface cd openface python setup.py install *

  Download dlibs models with: ./models/get-models.sh

Open face is now installed. Test it with * ./demos/classifier.py infer models/openface/celeb-classifier.nn4.small2.v1.pkl ./images/examples/carell.jpg

相關文章