简体   繁体   English

Bash:安装virtualenvwrapper后如何刷新shell [不重新启动shell]?

[英]Bash: How refresh shell after installing virtualenvwrapper [Without restarting the shell]?

I am using python-fabric to setup my server, which configures the server programatically. 我正在使用python-fabric来设置我的服务器,它以编程方式配置服务器。

So, I installed virtualenvwrapper as : 所以,我安装了virtualenvwrapper

sudo apt-get install virtualenvwrapper

That installed - Virtualenvwrapper and adds its initialization scripts to shell startup. 安装了 - Virtualenvwrapper并将其初始化脚本添加到shell启动。

Generally we restart the shell and it gets initialized, but in my case I can-not restart the shell over fabric . 一般来说,我们重新启动外壳,它被初始化,但对我来说,我可以,不重新启动在壳fabric

Since it was installed with apt-get I was not able to find the initialization scripts entry in ~/.bashrc or ~/.bash_profile or /etc/bash.bashrc 由于它是用apt-get安装的,我无法在~/.bashrc~/.bash_profile/etc/bash.bashrc找到初始化脚本条目

So, where did apt-get added call to the initialization scripts ? 那么, apt-get在哪里添加了对初始化脚本的调用?

How to refresh the shell without restarting the shell ? 如何在不重启shell情况下刷新shell?

Solved the problem : 解决了这个问题:

source /etc/bash_completion.d/virtualenvwrapper

This is where it was storing all its magic which gets included to .bashrc automatically. 这是它存储所有魔法的地方,自动包含在.bashrc

Try hash -r . 尝试hash -r It is a bash builtin. 这是一个内置的bash。

try 尝试

source /usr/local/bin/virtualenvwrapper.sh

But I'm not sure the path of virtualenvwrapper.sh installed from apt-get. 但我不确定从apt-get安装virtualenvwrapper.sh的路径。 (I usually use easy_install) (我通常使用easy_install)

Try rehash . 尝试rehash (http://www.computerhope.com/unix/urehash.htm) (http://www.computerhope.com/unix/urehash.htm)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM