zoukankan      html  css  js  c++  java
  • virtualenvwrapper

    1. 安装virtualenv
    sudo pip install virtualenv
    2. 安装virtualenvwrapper
    sudo pip install virtualenvwrapper

    默认会将virtualenvwrapper安装到/usr/local/bin目录下,需要在用户的.bsharc文件中增加如下配置:

    1.  
      # 1. Create a directory to hold the virtual environments.
    2.  
      # (mkdir $HOME/.virtualenvs).
    3.  
      # 2. Add a line like "export WORKON_HOME=$HOME/.virtualenvs"
    4.  
      # to your .bashrc.
    5.  
      # 3. Add a line like "source /path/to/this/file/virtualenvwrapper.sh"
    6.  
      # to your .bashrc.
    7.  
      # 4. Run: source ~/.bashrc
    8.  
      # 5. Run: workon
    9.  
      # 6. A list of environments, empty, is printed.
    10.  
      # 7. Run: mkvirtualenv temp
    11.  
      # 8. Run: workon
    12.  
      # 9. This time, the "temp" environment is included.
    13.  
      # 10. Run: workon temp
    14.  
      # 11. The virtual environment is activated.

    根据步骤,当运行source ./.bashrc报错:

    1.  
      /usr/bin/python: No module named virtualenvwrapper
    2.  
      virtualenvwrapper.sh: There was a problem running the initialization hooks.
    3.  
      If Python could not import the module virtualenvwrapper.hook_loader,
    4.  
      check that virtualenvwrapper has been installed for
    5.  
      VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is
    6.  
      set properly.

    错误原因:Ubuntu安装了2.7和3.x两个版本的python,在安装时使用的是sudo pip3 install virtualenvwrapper
    在我运行的时候默认使用的是python2.x,但在python2.x中不存在对应的模块。(virtualenvwrapper.sh文件内容如下:):

    1.  
      # Locate the global Python where virtualenvwrapper is installed.
    2.  
      if [ "$VIRTUALENVWRAPPER_PYTHON" = "" ] then
    3.  
      VIRTUALENVWRAPPER_PYTHON="$(command which python)"
    4.  
      fi

    当不存在VIRTUALENVWRAPPER_PYTHON环境时,会默认选择使用which python(我这里默认是python2),

    所以需要增加此环境变量:

    VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
  • 相关阅读:
    C-Lodop 非典型应用
    这里有个坑---js日期格式yyyy-MM-dd与yyyy/MM/dd
    这里有个坑---[NotMapped]不要忘了加
    这里有个坑---entity为null的问题
    数据库优化小技巧总结
    前端优化小技巧总结
    前端日志探讨二
    25.密码学知识-对称加密-2——2019年12月19日
    24.mongodb可视化工具部署——2019年12月19日
    22.Express框架——2019年12月19日
  • 原文地址:https://www.cnblogs.com/zhaohuanhuan/p/9431118.html
Copyright © 2011-2022 走看看