简体   繁体   English

bash_profile配置混乱

[英]bash_profile configure confusion

I am trying to install Python virtual environment using STEP:5 in this link Install OpenCV 3 on macOS with Homebrew (the easy way) 我试图在此链接中使用STEP:5安装Python虚拟环境,并通过Homebrew在macOS上安装OpenCV 3(简单方法)

I am having trouble in configuring this file properly 我无法正确配置此文件

$ nano ~/.bash_profile

Only editing the bash_profile like show 仅像显示一样编辑bash_profile

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

Is not allowing me to goto next step 不允许我继续下一步

I got this Warning mkvirtualenv: command not found 我收到此警告mkvirtualenv: command not found

So altered it using help with this techstricks.com/mkvirtualenv-command-not-found-virtualenvwrapper/ 因此,通过使用此techstricks.com/mkvirtualenv-command-not-found-virtualenvwrapper/帮助对其进行了techstricks.com/mkvirtualenv-command-not-found-virtualenvwrapper/

Found this link on how to virtualenwrapper virtualenvwrapper.readthedocs.io/en/latest/install.html#python-interpreter-virtualenv-and-path 找到了有关如何虚拟virtualenvwrapper.readthedocs.io/en/latest/install.html#python-interpreter-virtualenv-and-path链接virtualenvwrapper.readthedocs.io/en/latest/install.html#python-interpreter-virtualenv-and-path

My bash_profile contains 我的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'

When I try to $ source ~/.bash_profile 当我尝试$ source ~/.bash_profile

I'm getting this 我得到这个

-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.

How do I fix this??????? 我该如何解决???????

I finally got it working. 我终于让它工作了。

I installed Virtualenv and Wrapper separatley 我安装了Virtualenv和Wrapper separatley

pip install virtualenv

Might help someone in future. 将来可能会帮助某人。


I installed Virtual Enviornment Wrapper using 我使用以下方法安装了虚拟环境包装器

pip install --user virtualenvwrapper

Link 链接

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

Content of my bash_profile file 我的bash_profile文件的内容

Homebrew 家酿

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

#export WORKON_HOME=$HOME/.virtualenvs #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' #Virtualenv / VirtualenvWrapper源/usr/local/bin/virtualenvwrapper.sh #export PROJECT_HOME = $ HOME / Devel #export VIRTUALENVWRAPPER_PYTHON = / usr / local / bin / python #export VIRTUALENVWRAPPER_VIRTUALENVV // usr / local / bin / virtualenvAP#export ='-no-site-packages'

Content of my bashrc file 我的bashrc文件的内容

export WORKON_HOME=$HOME/.virtualenvs 导出WORKON_HOME = $ HOME / .virtualenvs

export PROJECT_HOME=$HOME/projects 导出PROJECT_HOME = $ HOME / projects

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

I had the same exact issue, but the way I got around it was different than /u/Santhosh DC. 我遇到了完全相同的问题,但是解决该问题的方式与/ u / Santhosh DC不同。 Following the breaking changes in Homebrew sometime in the last two months, I had to change: VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python to VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2 . 在过去两个月中,Homebrew发生了重大变化之后,我不得不进行更改: VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python更改为VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2

Hope this helps someone. 希望这对某人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM