workon无法直接进入虚拟环境,显示找不到

1.打开.bash_file文件,检查下关于虚拟环境的路径配置

# Setting PATH for Python 2.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"
export PATH
          
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH

# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH 
    
if [ -f ~/.bashrc ] ; then
  source .bashrc
fi  
~                                                                                                                                                        
".bash_profile" [readonly] 18L, 551C

2.再打开.bashrc文件

export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:.
#虚拟环境置
if [ -f /Library/Frameworks/Python.framework/Versions/3.7/bin/virtualenvwrapper.sh ]; then
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3
source /Library/Frameworks/Python.framework/Versions/3.7/bin/virtualenvwrapper.sh
fi

image.png

找到之后然后再更正为现在virtualenvwrapper.sh路径就可以了。
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:.
这个主路径配置,如果出现大量的命令无法使用,就需要查看是否主路径配置有误

你可能感兴趣的:(workon无法直接进入虚拟环境,显示找不到)