在vagrantbox中找不到“mkvirtualenv命令”

时间:2018-01-28 09:09:01

标签: python django virtualenvwrapper

我正在尝试使用vagrant建立一个django项目,但是我收到了这个错误:

 Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-112-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.


Last login: Sun Jan 28 08:21:28 2018 from 10.0.2.2
vagrant@ubuntu-xenial:~$ mkvirtualenv profiles_api --python=python3
mkvirtualenv: command not found

在我的流浪文件中,我有以下内容:

sudo pip install virtualenvwrapper
    if ! grep -q VIRTUALENV_ALREADY_ADDED /home/ubuntu/.bashrc; then
        echo "# VIRTUALENV_ALREADY_ADDED" >> /home/ubuntu/.bashrc
        echo "WORKON_HOME=~/.virtualenvs" >> /home/ubuntu/.bashrc
        echo "PROJECT_HOME=/vagrant" >> /home/ubuntu/.bashrc
        echo "source /usr/local/bin/virtualenvwrapper.sh" >> /home/ubuntu/.bashrc
    fi

我安装了python 3.6,3.5和anaconda,如果这很重要的话。谢谢你的帮助

2 个答案:

答案 0 :(得分:0)

首先通过运行以下命令破坏无业游民的盒子:

vagrant destroy

将您的无业游民的文件更改为此:

sudo pip install virtualenvwrapper

if ! grep -q VIRTUALENV_ALREADY_ADDED /home/vagrant/.bashrc; then
    echo "# VIRTUALENV_ALREADY_ADDED" >> /home/vagrant/.bashrc
    echo "WORKON_HOME=~/.virtualenvs" >> /home/vagrant/.bashrc
    echo "PROJECT_HOME=/vagrant" >> /home/vagrant/.bashrc
    echo "source /usr/local/bin/virtualenvwrapper.sh" >> /home/vagrant/.bashrc
fi

现在使用 vagrant init 命令初始化您的vagrant框,然后运行 vagrant up 命令。

答案 1 :(得分:0)

输入无业游民时,请在终端中尝试此代码

html,
body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  user-select: none;
}

main {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
}

main>section {
  position: absolute;
  right: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
}

#first-section {
  top: 0;
  background-color: black;
}

#myVideo {
  position: fixed;
  right: 0;
  bottom: 0;
  min-width: 100%;
  min-height: 100%;
}

#services {
  top: 100vh;
  background-color: transparent;
}

#about-us {
  top: 200vh;
  background-color: yellow;
}

#ecommerce {
  top: 300vh;
  background-color: darkcyan;
}

#testimonials {
  top: 400vh;
  background-color: deeppink;
}

#footer {
  position: absolute;
  top: 33vh;
  right: 0;
  left: 0;
  width: 100%;
  height: 67vh;
  background-color: black;
  z-index: -1;
}

您必须更改文件的路径