Python Virtualenv - No module named virtualenvwrapper.hook_loader

前端 未结 16 1523
野趣味
野趣味 2020-12-02 06:01

I\'m running Mac OS 10.6.8. and wanted to install in addition to python 2.6 also python 2.7 and use python 2.7 in a new virtualenv. I executed the following steps:

I

16条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-02 06:37

    I had this problem after uninstalling the virtualenvwrapper package. When I logged in to any user (or su to a different one), I would get:

    Traceback (most recent call last):
      File "", line 1, in 
    ImportError: No module named virtualenvwrapper.hook_loader                                                                                                                                                                       
    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.
    

    The solution was to delete the /etc/bash_completion.d/virtualenvwrapper file.

    Edit:

    Do not delete the above file or it won't be recreated if you reinstall virtualenvwrapper. Instead what you need to do is purge the virtualenvwrapper package when you uninstall it. Like this on Debian:

    apt-get remove --purge virtualenvwrapper
    

提交回复
热议问题