나는 항상 virtualenv를 사용하고 있었고 아나콘다도 설치했습니다. 지금 막 source activate helloworld
같이 anaconda의 방법을 사용하여 사실상 환경을 활성화하는 것을 시도했다. (실제로이 명령을 정확히 입력했는지 기억하지 못합니다.) 그리고 나서 환경이 활성화되었습니다. 그러나 노트북을 사용하려 할 때 이미 그 환경에 라이브러리를 설치 했더라도 일부 라이브러리가 존재하지 않는다고합니다. 그때까지 나는 잘못된 환경을 활성화했다는 것을 깨달았습니다. 그런 다음 탭을 닫고 cd
부터 hellowworld
까지 source bin/activate
을 입력했습니다. 그러나 너무 늦었습니다. 출력이 prepending /home/lcc/anaconda3/envs/bin to PATH
이고 환경이 예상대로 활성화되지 않았습니다. 이 문제를 해결하는 방법을 알고 있습니까? 감사!아나콘다와 virtualenv의 충돌 문제를 해결하는 방법
#!/bin/bash
# Determine the directory containing this script
if [[ -n $BASH_VERSION ]]; then
_SCRIPT_LOCATION=${BASH_SOURCE[0]}
SHELL="bash"
elif [[ -n $ZSH_VERSION ]]; then
_SCRIPT_LOCATION=${funcstack[1]}
SHELL="zsh"
else
echo "Only bash and zsh are supported"
return 1
fi
_CONDA_DIR=$(dirname "$_SCRIPT_LOCATION")
if [ $# -gt 1 ]; then
(>&2 echo "Error: did not expect more than one argument.")
(>&2 echo " (Got [email protected])")
return 1
fi
case "$(uname -s)" in
CYGWIN*|MINGW32*|MSYS*)
EXT=".exe"
;;
*)
EXT=""
;;
esac
# Export whatever PS setting we have, so it is available to Python subprocesses
export PS1
# Ensure that this script is sourced, not executed
# Also note that errors are ignored as `activate foo` doesn't generate a bad
# value for $0 which would cause errors.
if [[ -n $BASH_VERSION ]] && [[ "$(basename "$0" 2> /dev/null)" == "activate" ]]; then
(>&2 echo "Error: activate must be sourced. Run 'source activate envname'
instead of 'activate envname'.
")
"$_CONDA_DIR/conda" ..activate $SHELL$EXT -h
exit 1
fi
"$_CONDA_DIR/conda" ..checkenv $SHELL$EXT "[email protected]"
if (($? != 0)); then
return 1
fi
# Ensure we deactivate any scripts from the old env
# Note: this empties [email protected] Preserve a copy.
[email protected]
source "$_CONDA_DIR/deactivate"
_NEW_PATH=$("$_CONDA_DIR/conda" ..activate $SHELL$EXT "$args")
if (($? == 0)); then
export CONDA_PATH_BACKUP="$PATH"
# export this to restore it upon deactivation
export CONDA_OLD_PS1=$PS1
export PATH="$_NEW_PATH"
# Get first path (should be full path prefix of our env)
# inner string extraction pulls off first path
# outer string removes /bin if present (on Unix)
firstpath=${PATH%%:*}
export CONDA_DEFAULT_ENV="$(echo ${firstpath} | sed "s|/bin$||")" &>/dev/null
# Legacy support: CONDA_DEFAULT_ENV used to be either env name or full path if given as path.
# CONDA_DEFAULT_ENV is now always full path.
# Keep CONDA_ENV_PATH around, and have it mirror CONDA_DEFAULT_ENV.
# Last date of change: 2016-04-18
export CONDA_ENV_PATH=$CONDA_DEFAULT_ENV
export PS1="$("$_CONDA_DIR/conda" ..setps1 $SHELL$EXT "$args")"
# Load any of the scripts found $PREFIX/etc/conda/activate.d AFTER activation
_CONDA_D="${CONDA_DEFAULT_ENV}/etc/conda/activate.d"
if [[ -d "$_CONDA_D" ]]; then
IFS=$(echo -en "\n\b")&>/dev/null && for f in $(find "$_CONDA_D" -iname "*.sh"); do source "$f"; done
fi
else
return $?
fi
if [[ -n $BASH_VERSION ]]; then
hash -r
elif [[ -n $ZSH_VERSION ]]; then
rehash
else
echo "Only bash and zsh are supported"
return 1
fi