Laqide 2018-01-20 07:24 采纳率: 50%
浏览 4861
已结题

我就想装个虚拟环境,virtualenvwrapper,可怎么老提示找不到anaconda的路径

我在~/.bashrc里面写了export WORKON_HOME=$HOME/.virtualenvs 和 source /usr/local/bin/virtualenvwrapper.sh 但是,每次source ~/.bashrc,都会报错:bash: /home/zhaoyang/anaconda/bin/python: 没有那个文件或目录
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=/home/zhaoyang/anaconda/bin/python and that PATH is
set properly.
可是,奇怪的是,虽然报错了,但是虚拟环境已经可以用了,workon 指令也能用了,创建出来的虚拟环境也在指定的目录下。但每次workon 虚拟环境名,都会报这样的错误:bash: /home/zhaoyang/anaconda/bin/python: 没有那个文件或目录
bash: /home/zhaoyang/anaconda/bin/python: 没有那个文件或目录
bash: /home/zhaoyang/anaconda/bin/python: 没有那个文件或目录
bash: /home/zhaoyang/anaconda/bin/python: 没有那个文件或目录
大神们!我该怎么办,虽然我不是处女座,但真心不想凑活!不想计算机老报错了。谢谢!

  • 写回答

4条回答

  • 松鼠辣椒 2018-11-16 13:31
    关注

    错误原因:
    Ubuntu安装了2.7和3.x两个版本的python,在安装时使用的是sudo pip3 install virtualenvwrapper
    在我运行的时候默认使用的是python2.x,但在python2.x中不存在对应的模块。
    (virtualenvwrapper.sh文件内容如下:):
    if [ "$VIRTUALENVWRAPPER_PYTHON" = "" ] then
    VIRTUALENVWRAPPER_PYTHON="$(command \which python)"
    fi
    解决方法:修改virtualenvwrapper.sh文件
    1.which virtualenvwrapper.sh找到文件路径
    2.在文件路径下sudo vim virtualenvwrapper.sh
    3.修改:
    if [ "$VIRTUALENVWRAPPER_PYTHON" = "" ] then
    VIRTUALENVWRAPPER_PYTHON="$(command \which python3)"
    fi
    解决

    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?