zoukankan      html  css  js  c++  java
  • No module named virtualenvwrapper 虚拟环境报错

    No module named virtualenvwrapper 虚拟环境报错

    1. 安装虚拟环境命令
    sudo pip install virtualenv
    sudo pip install virtualenvwrapper
    
    # 1、创建目录用来存放虚拟环境
    mkdir $HOME/.virtualenvs    # $HOME代表家目录,用于保存虚拟环境产生的目录
    
    # 2、打开~/.bashrc文件,并添加如下:
    export WORKON_HOME=$HOME/.virtualenvs  # 导入虚拟环境保存的目录
    source /usr/local/bin/virtualenvwrapper.sh  # 添加命令的路径
    
    # 3、运行
    source ~/.bashrc  # 让命令生效
    

    接下来如果出现下列报错的话,是因为在~/.bashrc这个文件中没有设置python解释器的路径

    /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 virtualenvwrapper has been installed for
    VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
    set properly.
    

    需要插入如下代码

    export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
    export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
    

    然后再运行命令

    source ~/.bashrc
    

    如果出现下面的输出

    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/initialize
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/premkvirtualenv
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/postmkvirtualenv
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/prermvirtualenv
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/postrmvirtualenv
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/predeactivate
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/postdeactivate
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/preactivate
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/postactivate
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/get_env_details
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/premkproject
    virtualenvwrapper.user_scripts creating /home/ubuntu/.virtualenvs/postmkproject
    

    表示虚拟环境的命令导入成功了,可以正常使用

  • 相关阅读:
    zoomer.for.jquery 图片效果(缩小、放大)
    简体、繁体字转换 Microsoft AppLocale 实用程序
    jquery图片效果(缩小放大)
    JQuery自动为表格增加一列
    HTTP 错误 403.9 禁止访问:连接的用户过多怎么办?
    控件数组
    apache服务无法启动
    枚举记录不同斜率值 set容器——pku3668
    分数最佳接近——pku3039
    01背包——[Usaco2008 Dec]Hay For Sale
  • 原文地址:https://www.cnblogs.com/technicianafei/p/14581106.html
Copyright © 2011-2022 走看看