【发布时间】:2021-11-10 11:55:47
【问题描述】:
我有 conda 4.5.11,我正在尝试运行一个 bash 脚本来激活我创建的 coda 环境。但是它一直告诉我:
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If your shell is Bash or a Bourne variant, enable conda for the current user with
$ echo ". /nvme/h/buildsets/eb_cyclone/software/Anaconda3/5.3.0/etc/profile.d/conda.sh" >> ~/.bashrc
or, for all users, enable conda with
$ sudo ln -s /nvme/h/buildsets/eb_cyclone/software/Anaconda3/5.3.0/etc/profile.d/conda.sh /etc/profile.d/conda.sh
The options above will permanently enable the 'conda' command, but they do NOT
put conda's base (root) environment on PATH. To do so, run
$ conda activate
in your terminal, or to put the base environment on PATH permanently, run
$ echo "conda activate" >> ~/.bashrc
Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
your ~/.bashrc file. You should manually remove the line that looks like
export PATH="/nvme/h/buildsets/eb_cyclone/software/Anaconda3/5.3.0/bin:$PATH"
^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
Traceback (most recent call last):
File "main_foml_trans.py", line 7, in <module>
import tensorflow as tf
ModuleNotFoundError: No module named 'tensorflow'
然而,这就是我的.bashrc 的样子:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
export DATA_p077=/onyx/data/p077
export DATA_p078=/onyx/data/p078
. /nvme/h/buildsets/eb_cyclone/software/Anaconda3/5.3.0/etc/profile.d/conda.sh
conda activate
我不确定发生了什么以及如何解决此错误,尽管从消息中很明显,但一切都在那里,这是一种奇怪的行为。
这是我正在使用的 bash 脚本:
#!/usr/bin/env bash
#SBATCH --job-name=fgpu
#SBATCH --account=p077
#SBATCH --partition=gpu
#SBATCH --nodes=1
#SBATCH --gres=gpu:1
#SBATCH --gpus=1
#SBATCH --mem=16000
#SBATCH --time=0-01:00:00
module load Anaconda3/5.3.0
conda activate tensorflow-dementia
jobid=$SLURM_JOBID
python main_foml_trans.py > job${jobid}.txt
【问题讨论】:
标签: python bash anaconda conda