virtualenv - 如何在 Vagrant 中正确使用 virtualenv + virtualenvwrapper?

标签 virtualenv vagrant virtualenvwrapper

我发现安装virtualenv + virtualenvwrapper最方便的方法是使用 virtualenvburrito

现在我可以通过以下方式在 vagrant 供应中自动执行 pip 安装:

Vagrantfile 中的行:

config.vm.provision :shell, :path => "bootstrap.sh"

bootstrap.sh 中的行:

curl -s https://raw.github.com/brainsik/virtualenv-burrito/master/virtualenv-burrito.sh | $SHELL
source /root/.venvburrito/startup.sh
cd /vagrant      
mkvirtualenv my_project
pip install -r requirements.txt 

然后我运行 vagrant ssh 但随后我必须运行以下命令才能访问我的虚拟环境:

sudo -i
source /root/.venvburrito/startup.sh
workon my_project

我不想总是运行 sudo -isource/root/.venvburrito/startup.sh,我只是想能够直接运行workon my_project

但是

(I.)我似乎无法将 source/root/.venvburrito/startup.sh 附加到我的 ~/.profile

(II.)即使它被附加到该文件中,我也会收到权限错误。我似乎也无法更改任何 protected 文件的权限。

最佳答案

处理 (I.) 和 (II.) 的最佳方法是将 Vagrantfile 中的 privileged 属性设置为 false .

参见here

关于virtualenv - 如何在 Vagrant 中正确使用 virtualenv + virtualenvwrapper?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22042866/

相关文章:

python - Virtualenvwrapper:没有名为 virtualenvwrapper 的模块

python - FlaskApp 使用 mod_wsgi 在 apache 中返回 http 500

javascript - 获得一个工作 meteor JS Vagrant 盒子

python - 在 Vagrant 配置期间更新 .bashrc 和环境变量

python - 如何在主管中使用 virtualenvwrapper?

python - Virtualenv 特定的 pip 配置文件

python - 在另一个驱动器上创建 virtualenv - 访问被拒绝

python - pip 不存在或无法在 virtualenv 中执行

ubuntu - Vagrant 中的 Redis(Ubuntu): how to forward redis port?

laravel - Virtual Box- 意外删除 vmdk 文件。我能做些什么?