bash_profile配置混乱

时间:2017-08-17 13:14:09

标签: python opencv

我正在尝试使用此链接Install OpenCV 3 on macOS with Homebrew (the easy way)

中的STEP:5安装Python虚拟环境

我无法正确配置此文件

$ nano ~/.bash_profile

仅编辑bash_profile,如show

# Virtualenv/VirtualenvWrapper
source /usr/local/bin/virtualenvwrapper.sh

不允许我转到下一步

我收到了此警告mkvirtualenv: command not found

使用此techstricks.com/mkvirtualenv-command-not-found-virtualenvwrapper/

的帮助改变了它

找到关于如何使用virtualenwrapper的链接  virtualenvwrapper.readthedocs.io/en/latest/install.html#python-interpreter-virtualenv-and-path

我的bash_profile包含

    #Homebrew
export PATH=/usr/local/bin:$PATH

export WORKON_HOME=$HOME/.virtualenvs

# Virtualenv/VirtualenvWrapper
source /usr/local/bin/virtualenvwrapper.sh
export PROJECT_HOME=$HOME/Devel
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'

当我尝试$ source ~/.bash_profile

我收到了这个

-bash: /usr/local/bin/python: No such file or directory
virtualenvwrapper.sh: There was a problem running the initialization hooks. 

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python and that PATH is
set properly.

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:0)

我终于明白了。

我安装了Virtualenv和Wrapper separatley

<?php

$term=$_POST['term'];
$level=$_POST['level'];

if  ($term == 'First' && $level=='js1')
  {
    header("Location: result.php");
    exit();
  } 
else if ($term == 'First' && $level='js2')
  {
    header("Location: result2.php");
    exit();
  } 
else {
  $error = "Entry is invalid";
}

?>

将来可能会帮助别人。

我使用

安装了Virtual Enviornment Wrapper
pip install virtualenv

链接

  

virtualenvwrapper.readthedocs.io/en/latest/install.html#python-interpreter-virtualenv-and-path

我的bash_profile文件的内容

  

自制

     

export PATH = / usr / local / bin:$ PATH

     

#export WORKON_HOME = $ HOME / .virtualenvs

     

#Virtualenv / VirtualenvWrapper      来源/usr/local/bin/virtualenvwrapper.sh      #export PROJECT_HOME = $ HOME / Devel      #export VIRTUALENVWRAPPER_PYTHON = / usr / local / bin / python      #export VIRTUALENVWRAPPER_VIRTUALENV = / usr / local / bin / virtualenv      #export VIRTUALENVWRAPPER_VIRTUALENV_ARGS =' - no-site-packages'

我的bashrc文件的内容

  

导出WORKON_HOME = $ HOME / .virtualenvs

     

export PROJECT_HOME = $ HOME / projects

     

来源/usr/local/bin/virtualenvwrapper.sh

答案 1 :(得分:0)

我有同样的问题,但我绕过它的方式与/ u / Santhosh DC不同。在过去两个月的某个时间Homebrew发生了重大变化后,我不得不改变:     VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python 至     VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2

希望这有助于某人。