0

I have some problems with python and import errors. whenever I open the terminal, before entering any commands I get this:

/Library/Frameworks/Python.framework/Versions/3.6/bin/python3: 
Error while finding module specification for 
'virtualenvwrapper.hook_loader' (ModuleNotFoundError: 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=/Library/Frameworks/ 
Python.framework/Versions/3.6/bin/python3 and that PATH is
set properly.

also when I type python in the terminal I get this error:

ImportError: No module named site

I don't know why, but I get this every time that I want to install a package with pip

  • Possible duplicate of [/usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook\_loader' (: No module named 'virtualenvwrapper')](https://stackoverflow.com/questions/33216679/usr-bin-python3-error-while-finding-spec-for-virtualenvwrapper-hook-loader) – jose_bacoy May 15 '19 at 20:42

1 Answers1

0

This comes down to backwards compatibility and you likely just need to update your ~/.bashrc by entering the following:

nano ~/.bashrc

Change

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3

to

export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python

That will likely solve your issue.

DougM
  • 920
  • 1
  • 9
  • 21
  • I can not find `~/.bashrc` where is it? I just have `~/.bash_profile` – niloofar latifian May 15 '19 at 20:56
  • .bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells. Are you in your home directory? Also, what OS? If there is nothing in your home directory you can create one as it is user specific but make sure there is nothing there first. The system wide bash is in /etc/bash.bashrc. – DougM May 15 '19 at 21:03