Terminal issue with virtualenvwrapper after Maveri

2019-01-21 10:26发布

After upgrading to OSX Mavericks, I am getting this message in the terminal:

/usr/bin/python: No module named virtualenvwrapper
virtualenvwrapper.sh: There was a problem running the initialization hooks. 

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

7条回答
老娘就宠你
2楼-- · 2019-01-21 10:59

Re-arrange the export order so that the python path is placed before the virtualenv commands in your .bash_profile file.

# python path
export PATH=/usr/local/bin:$PATH

# needed for virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
查看更多
三岁会撩人
3楼-- · 2019-01-21 11:04

Try edit .bash_profile file

# Home brew
export PATH=/usr/local/bin:$PATH

# virtualenvwrapper 
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
source /usr/local/bin/virtualenvwrapper.sh
查看更多
霸刀☆藐视天下
4楼-- · 2019-01-21 11:08

Try reinstalling pip and then reinstalling virtualenvwrapper (I had to go through these steps after upgrading to Mavericks):

$ sudo easy_install pip
$ sudo pip install --upgrade virtualenvwrapper
查看更多
\"骚年 ilove
5楼-- · 2019-01-21 11:10

I wouldn't recommend running pip with sudo. This was my solution for the same problem (after upgrading to Mavericks).

In essence, uninstall any virtualenv and brewed Python you had before (use which <command> to check that you removed everything except the system Python in /usr/bin/python) and cleanly install them once again:

brew install python --with-brewed-openssl
# Open a new terminal tab now (to access /usr/local/bin/python)
pip install virtualenv
pip install virtualenvwrapper
查看更多
ゆ 、 Hurt°
6楼-- · 2019-01-21 11:10

Running these two commands helped me get rid of it (had done a software update on macOS High Sierra)

$ sudo easy_install pip

$ sudo pip install --upgrade virtualenvwrapper
查看更多
淡お忘
7楼-- · 2019-01-21 11:11

pip install --upgrade virtualenvwrapper will fix the issue but never used sudo pip this will change system-wide. If pip throws permission errors without sudo then you should fix those and then try only with pip install <--upgrade> $(package).

I rather suggest install homebrew and then install pip using brew install pip which will install latest stable version of pip for you.

  1. Install homebrew and then run brew doctor . If there are any warnings fix those(actually brew will tell you how to fixed those).

  2. You may need to remove system-wide python comes with Mac and use brew to install required versions. Use this to remove system-wide python

  3. Use brew install python or/and brew install python3 to install required python version/s.
  4. Finaly run pip install --upgrade virtualenvwrapper

  5. Now on never use sudo pip only use pip.

查看更多
登录 后发表回答