由于在ubuntu环境下,将python做与python3.6做了软链接(ln -s python python3.6),并且pip也被我做了软链接,所以导致用pip安装virtualenvwrapper之后,在source启动virtualenvwrapper.sh时以及workon 虚拟环境时总是报错:

 ./virtualenvwrapper.sh: line : : command not found
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= and that PATH is
set properly.

这是根据提示230行的语句:

 "$VIRTUALENVWRAPPER_PYTHON" -m 'virtualenvwrapper.hook_loader' \

结合错误信息与提示找到的语句,猜测应该是VIRTUALENVWRAPPER_PYTHON这里有问题,然后在virtualenvwrapper.sh文件中查找VIRTUALENVWRAPPER_PYTHON,发现了关键点:

 # Locate the global Python where virtualenvwrapper is installed.
if [ "${VIRTUALENVWRAPPER_PYTHON:-}" = "" ]
then
VIRTUALENVWRAPPER_PYTHON="$(command \which python3)" # 原本是写的\which python,这里贴出来的是我修改为python3后的。
fi

VIRTUALENVWRAPPER_PYTHON是用来(Locate the global Python where virtualenvwrapper is installed.)定位哪个python下面安装了virtualenvwrapper的。原本指定的位置是python,也就是2.7版本的。鉴于之前我使用python3.6安装的,所以此处要改成python3。然后这个错误就消失了。


使用virtualenvwrapper的好处是不用每次使用source /xxx/虚拟环境/bin/activate来启动虚拟环境了,在~/.bashrc配置一下,日后开启虚拟环境直接可以用workon命令即可,具体操作步骤,前提是你已经安装了python-virtualenv了:

# Setup:
# . Create a directory to hold the virtual environments.
# (mkdir $HOME/.virtualenvs).
# . Add a line like "export WORKON_HOME=$HOME/.virtualenvs"
# to your .bashrc.
# . Add a line like "source /path/to/this/file/virtualenvwrapper.sh"
# to your .bashrc.
# . Run: source ~/.bashrc
# . Run: workon
# . A list of environments, empty, is printed.
# . Run: mkvirtualenv temp
# . Run: workon
# . This time, the "temp" environment is included.
# . Run: workon temp
# . The virtual environment is activated.

virtualenvwrapper.sh报错: There was a problem running the initialization hooks.解决的更多相关文章

  1. source .bashrc 报错:virtualenvwrapper.sh: There was a problem running the initialization hooks.

    在Ubuntu下安装完virtualenv.virtualenvwrapper,然后设置环境文件 .bashrc 接着 source .bashrc,产生错误信息 首先确认了 libpam-mount ...

  2. virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper.........(解决办法)

    Linux(ubuntu)上python2与python3共存环境下,安装virtualenvwrapper后, 其环境变量被自动设置为VIRTUALENVWRAPPER_PYTHON=/usr/bi ...

  3. 11.2.0.4 aix下运行第二个节点root.sh报错处理

    第二个节点运行root.sh报错如下 Entries will be added to the /etc/oratab file as needed by Database Configuration ...

  4. Sphinx/Coreseek 4.1 执行 buildconf.sh 报错,无法生成configure文件

    参考的网址: http://blog.csdn.net/jcjc918/article/details/39032689 错误现象: 执行 buildconf.sh 报错,无法生成configure文 ...

  5. windows中修改catalina.sh上传到linux执行报错This file is needed to run this program解决

    windows中修改catalina.sh上传到linux执行报错This file is needed to run this program解决 一.发现问题 由于tomcat内存溢出,在wind ...

  6. win10 安装nodejs,报错there is a problem in the windows installer package

    今天重装了win10系统,开始安装各种软件,装到node的时候我崩溃了,报错there is a problem in the windows installer package··· 度娘了各种安装 ...

  7. centos 7安装rac 11gR2时运行root.sh报错找不到ohas服务(ohasd failed to start)

    单独在linux 7中为ohasd设置一个服务.步骤如下1. 创建服务ohas.service的服务文件并赋予权限touch /usr/lib/systemd/system/ohas.servicec ...

  8. Linux安装Redis 6.0.5 ./install_server.sh报错

    Linux安装Redis 6.0.5 ./install_server.sh报错 linux 安装Redis6.0.5时 进行到./install_server.sh时报错, This systems ...

  9. 使用git克隆仓库到本地报错:SSL certificate problem: unable to get local issuer certificate

    第一次使用Git工具克隆仓库,使用的是HTTPS链接,失败了.发现是因为通过HTTPS访问时,如果服务器上的SSL证书未经过第三方机构认证,Git就会报错. 解决方法:通过命令关闭验证 git con ...

随机推荐

  1. 小试JVM工具

    一.前言 工欲善其事必先利其器,jdk自带了很多工具,利用好这些工具能够帮我们获取想要的数据(运行日志.异常堆栈.GC日志.线程快照.堆转储快照等),从而快速的分析数据.定位问题. 二.jps:虚拟机 ...

  2. C#基础之方法

    方法组成为: public void Fun(string name) { 代码块 } 1.方法的访问级别:修饰符,即上边的Public 2.返回类型:方法是否具有返回值,上边方法无返回值即为void ...

  3. springCloud当中Eureca sever当中Camden到底是什么?

    [学习笔记] 做个普通的maven project,quickstart archetype.改成jdk.8.下面Camden.SR1是版本名,springcloud的版本名称很奇特,它是按照伦敦地铁 ...

  4. map中使用await 异步函数

    let result=await Promise.all(dataComments.map(async (ele)=>{ return (async ()=>{ let resData= ...

  5. Android - Zxing实现二维码的扫描与生成

    Zxing: Zxing是一个开放源码,用java实现的多种格式的1D/2D条码图像处理库,它包含了联系到其他语言的端口.可以实现使用手机内置摄像头完成条形码的扫描以及解码. github:     ...

  6. MySQL常用函数使用示例

    #从指定字符中,随机生成12位字符select substring('0123456789abcdefghijklmnopqrstuvwxyz',floor(0+RAND()*36),12); #显示 ...

  7. java25个Java机器学习工具&库

    本列表总结了25个Java机器学习工具&库: 1. Weka集成了数据挖掘工作的机器学习算法.这些算法可以直接应用于一个数据集上或者你可以自己编写代码来调用.Weka包括一系列的工具,如数据预 ...

  8. Android学习总结(九)———— 内容提供器(ContentProvider)

    一.内容提供器基本概念 内容提供器主要用于在不同的应用程序之间实现数据共享的功能,它提供了一套完整的机制,允许一个程序访问另一个程序中的数据,同时还能保证被访数据的安全性.详细资料请看下图: 二.示例 ...

  9. hihoCode r#1077 : RMQ问题再临-线段树

    思路: 两种实现方法: (1)用链表(2)用数组. #include <bits/stdc++.h> using namespace std; int n, q, L, R, op, P, ...

  10. LeetCode Isomorphic Strings 对称字符串

    题意:如果两个字符串是对称的,就返回true.对称就是将串1中的同一字符都一起换掉,可以换成同串2一样的. 思路:ASCII码表哈希就行了.需要扫3次字符串,共3*n的计算量.复杂度O(n).从串左开 ...