/usr/bin/python3: Error while finding spec for 

2019-03-09 16:28发布

I'm trying to follow How To Serve Django Applications with uWSGI and Nginx on Ubuntu 14.04 and I'm failing at the very earlier stage, due to amount of output, I placed all related information into Pastebin.com - #1 paste tool since 2002!.

the actual error:

root@alexus:~# echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
root@alexus:~# source ~/.bashrc
/usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportError'>: 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 virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 and that PATH is
set properly.
root@alexus:~#

I'm following how to to the teeth, what am I doing wrong?

8条回答
SAY GOODBYE
2楼-- · 2019-03-09 17:31

In macOS Sierra, If you installed virtualenv package using pip3, add following to .bash_profile

export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3

or

export VIRTUALENVWRAPPER_PYTHON=$(which python3)

after that every new virtualenvironment you created using workon myvenv uses python3 as python interpreter

查看更多
疯言疯语
3楼-- · 2019-03-09 17:32

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python

good choice, but you already knew /usr/bin/python is 2.7

If you want to use version 3

sudo apt-get install python3-pip

and logout & login

查看更多
登录 后发表回答