time zsh -i -c "exit"
zsh -i -c "exit" 0.67s user 0.19s system 99% cpu 0.863 total
ãããĒį°åĸã ãŖã. ããŽå
ãŽããã 0.7 į¨åēĻã pyenv init
ã ãŖã. env įŗģãããã¤ãäŊŋãŖãĻãäēē㯠anyenv ãĢãžã¨ãããŽãæåšãããããį§ã¯ pyenv ãããããäŊŋãŖãĻãĒã.
åéĄã¯ããˇã§ãĢãčĩˇåããããã¨ããŖãĻãã¤ã python ãåŧãļããã§ã¯ãĒãã¨ãããã¨. ããŽãããĢäēēįãŽč˛´éãĒ 0.7 į§ãč˛ģããããĻãããŽããããĒã. ã¨ãããã㧠python ãäŊŋããˇã§ãĢãŽä¸ã ã㧠pyenv init
ãããã¨ãĢãã. python ãäŊŋãããŠãããčĻåããæšæŗã¯įĩåąã python
ãåŠãããŠããã . ããã㯠pip
ã.
ã¨ããããã§æŦĄãŽãããĒč§ŖæąēæŗãææĄãã:
python
(ãžã㯠pip
) ãåŠãã¨ããĢ pyenv init
ããæäŊãåˇŽãčžŧã
ãžãã¯ãã¤ã pyenv init
ãããããĒãŗãŧãã pyenv-init
ã¨ããéĸæ°ãĢããĻãã. ã¤ãã§ãĢ pyenv
čĒäŊã¸ãŽããšãéãã¨ããä¸įˇãĢããĻã. ã㨠pyenv ãå
ĨããĻãĒãį°åĸã§ãæģãĒãĒããããĢããã¨ãããĻã (ããšãĻãŽį°åĸã§åä¸ãŽč¨åŽããĄã¤ãĢãéŠį¨ããããŽã§ãį§ã¯).
pyenv-init() {
if [ -d ~/.pyenv ]; then
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$HOME/.pyenv/bin:$PATH"
[ -d $PYENV_ROOT ] && eval "$(pyenv init -)"
fi
}
ããã python ãåŧãã ãåŧã°ããã. python
ã¨ããéĸæ°ã§åŽįžŠããã¨æŦĄãŽãããĢãĒã.
python() {
pyenv-init
command python "$@"
}
ä¸ã§ python
ãåŧãļãŽãĢãåŧæ°ãããŽãžãžæ¸ĄããŽãĢ $@
ãä¸ããĻããŽã¨ã ãã¨åä¸åãŽéĸæ°ãäģåŽįžŠãããŽã§ãå帰åŧãŗåēãã§įĄéãĢãŧããĢãĒããĒããããĢ command
ã¨ãããŗããŗããäŊŋãŖãĻã.
ã¨ããã§ããã ã¨ãpython
ãåŧãļããŗãĢ pyenv-init
ãčĩ°ãŖãĻããžã. ä¸åčĩ°ãããĻããžãŖããããä¸čĻãĒãŽã§ãčĩ°ãããããŠãããããŠã°ã¨ããĻæãŖãĻããåŋ
čĻããã. į°ĄåãĒæšæŗã¨ããĻ㯠python
ã¨ããéĸæ°ãåå¨ããããããŠã°ãĢããĻããžããã¨ã . åãã¯č¨åŽããĄã¤ãĢãŽä¸ã§ä¸ãĢæ¸ãããããĒ python
ã¨ããéĸæ°ãåŽįžŠããĻåå¨ãããŽã§ããžã pyenv-init
ã¯čĩ°ãŖãĻããĒã. python
ãåŧãļã¨éĸæ°ãåå¨ãããŽã§ python
éĸæ°ãåŧã°ãã. äģã python
éĸæ°ãŽä¸ãĢ python
éĸæ°ãåé¤ããã¨ããæäŊãčŋŊå ãããã¨ãĢãã. ããã¨æŦĄåį§ģčĄãpython
ãåŧãļã¨éĸæ°ãåå¨ããĒããŽã§åŽčĄããĄã¤ãĢã¨ããĻ㎠python
ãčĻã¤ããĻãããåŽčĄãããã¨ãĢãĒã. ããŽã¨ããĢã¯æĸãĢ pyenv-init
ã¯åŽčĄæ¸ãŋã§ãããã¨ãäŋč¨ŧãããĻãã.
ã¨ããããã§æŦĄãŽãããĢãã
python() {
pyenv-init
unfunction python
python "$@"
}
unfunction
ãåŽčĄããæįšã§ python
ã¨ããéĸæ°ã¯åå¨ããĒã. ãĒãŽã§ command
ãäģããĒããĻããã¯ãå帰åŧåēãã§ã¯ãĒããĒãŖãĻãã.
python
ã¨åæ§ãŽãã¨ã pip
ãĢãäŊãŖãĻããã. ãããĻããŽå ´åãpython
ãžã㯠pip
ãä¸åēĻã§ãåŧãã ã pyenv-init
ã¯ä¸čĻãĒãŽã§ã 严æšå
ąã unfunction
ãã.