简体   繁体   English

无法导入模块virtualenvwrapper.hook_loader

[英]Cannot import module virtualenvwrapper.hook_loader

I've been fighting this issue for weeks, following the advice and guidance of several helpful related questions, but still cannot resolve. 在几个有用的相关问题的建议和指导下,我已经为这个问题解决了数周,但仍然无法解决。 I uninstalled and reinstalled easy_install, pip, virtualenv, and virtualenvwrapper on more than one occasion trying to resolve this issue. 为了解决此问题,我多次卸载并重新安装了easy_install,pip,virtualenv和virtualenvwrapper。 When I source .bashrc I get the following errors: 当我获取.bashrc时,出现以下错误:

Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name)
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals
  File "/usr/local/lib/python2.7/site-packages/virtualenvwrapper/hook_loader.py", line 16, in <module> from stevedore import ExtensionManager
ImportError: No module named stevedore
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/python2.7 and that PATH is
set properly.

Here is my .bashrc file: 这是我的.bashrc文件:

#set -x
if [ -f /usr/local/bin/virtualenvwrapper.sh ] ; then
  source /usr/local/bin/virtualenvwrapper.sh
fi
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export PATH=/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH
export PATH=/usr/local/sbin:$PATH
export PATH=/usr/local/bin:$PATH
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2.7
export PROJECT_HOME=$HOME/dev

I tried changing VIRTUALENVWRAPPER_PYTHON to /usr/local/bin/python - that gives me the same error sans the 2.7. 我尝试将VIRTUALENVWRAPPER_PYTHON更改为/ usr / local / bin / python-在2.7上给我同样的错误。 I also tried commenting out the export PATH line pointing to the 2.7 binary. 我还尝试注释掉指向2.7二进制文件的export PATH行。 That didn't work either. 那也不起作用。 I think that I've tried so many things that I probably have things severely botched up. 我认为我已经尝试了很多事情,以至于我可能已经严重破坏了事情。 If it helps, I installed Python using Homebrew and I have 2.7.13 and 3.6.3 installed. 如果有帮助,我使用Homebrew安装了Python,并安装了2.7.13和3.6.3。 In my /usr/local/bin directory my Python symbolic links are as follows: 在我的/ usr / local / bin目录中,我的Python符号链接如下:

lrwxr-xr-x  1 Scott  admin  34 Apr 11  2017 python -> ../Cellar/python/2.7.13/bin/python
lrwxr-xr-x  1 Scott  admin  41 Apr 11  2017 python-config -> ../Cellar/python/2.7.13/bin/python-config
lrwxr-xr-x  1 Scott  admin  35 Apr 11  2017 python2 -> ../Cellar/python/2.7.13/bin/python2
lrwxr-xr-x  1 Scott  admin  42 Apr 11  2017 python2-config -> ../Cellar/python/2.7.13/bin/python2-config
lrwxr-xr-x  1 Scott  admin  37 Apr 11  2017 python2.7 -> ../Cellar/python/2.7.13/bin/python2.7
lrwxr-xr-x  1 Scott  admin  44 Apr 11  2017 python2.7-config -> ../Cellar/python/2.7.13/bin/python2.7-config
lrwxr-xr-x  1 Scott  admin  35 Nov  2 23:06 python3 -> ../Cellar/python3/3.6.3/bin/python3
lrwxr-xr-x  1 Scott  admin  42 Nov  2 23:06 python3-config -> ../Cellar/python3/3.6.3/bin/python3-config
lrwxr-xr-x  1 Scott  admin  37 Nov  2 23:06 python3.6 -> ../Cellar/python3/3.6.3/bin/python3.6
lrwxr-xr-x  1 Scott  admin  44 Nov  2 23:06 python3.6-config -> ../Cellar/python3/3.6.3/bin/python3.6-config
lrwxr-xr-x  1 Scott  admin  38 Nov  2 23:06 python3.6m -> ../Cellar/python3/3.6.3/bin/python3.6m
lrwxr-xr-x  1 Scott  admin  45 Nov  2 23:06 python3.6m-config -> ../Cellar/python3/3.6.3/bin/python3.6m-config
lrwxr-xr-x  1 Scott  admin  35 Apr 11  2017 pythonw -> ../Cellar/python/2.7.13/bin/pythonw
lrwxr-xr-x  1 Scott  admin  36 Apr 11  2017 pythonw2 -> ../Cellar/python/2.7.13/bin/pythonw2
lrwxr-xr-x  1 Scott  admin  38 Apr 11  2017 pythonw2.7 -> ../Cellar/python/2.7.13/bin/pythonw2.7

...and my $PATH is: ...而我的$ PATH是:

$ echo $PATH
/usr/local/bin:/usr/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin

If you are using Python2, you probably installed a pakage from another Python version. 如果您使用的是Python2,则可能是从另一个Python版本安装了pakage。 Try this: 尝试这个:

$ sudo pip3 install virtualenvwrapper

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

相关问题 Python 无法导入模块 virtualenvwrapper.hook_loader? - Python could not import the module virtualenvwrapper.hook_loader? Python Virtualenv - 没有名为virtualenvwrapper.hook_loader的模块 - Python Virtualenv - No module named virtualenvwrapper.hook_loader /usr/bin/python3:查找“virtualenvwrapper.hook_loader”规范时出错(<class 'importerror'> : 没有名为“virtualenvwrapper”的模块)</class> - /usr/bin/python3: Error while finding spec for 'virtualenvwrapper.hook_loader' (<class 'ImportError'>: No module named 'virtualenvwrapper') 当我将 python3.7 降级到 python3.6 时,查找“virtualenvwrapper.hook_loader”的模块规范时出错 - Error while finding module specification for 'virtualenvwrapper.hook_loader' when I downgrade python3.7 to python3.6 导入模块virtualenvwrapper - Import-Module virtualenvwrapper Virtualenvwrapper:没有名为virtualenvwrapper的模块 - Virtualenvwrapper: no module named virtualenvwrapper 在Mac上安装virtualenvwrapper-找不到hook_loader.py pkg_resources - virtualenvwrapper install on Mac - hook_loader.py pkg_resources not found Virtualenvwrapper .hook:权限被拒绝 - Virtualenvwrapper .hook: Permission Denied 在Windows 8.1中安装virtualenvwrapper-powershell,导入模块失败 - Installing virtualenvwrapper-powershell in Windows 8.1, import-module failing ImportError:没有名为“ virtualenvwrapper”的模块 - ImportError: No module named 'virtualenvwrapper'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM