virtualenvwrapper.sh 在哪里?

kjo*_*kjo 36 python apt dpkg

我不知道更尴尬的是:我自己不知道如何去寻找这个问题的答案,或者根本就必须问这个问题,但是......

安装后脚本apt-get放在哪里?virtualenvwrapper.shvirtualenvwrapper

我不知所措...

% sudo apt-get install virtualenvwrapper
...
% rehash
% which virtualenvwrapper.sh
virtualenvwrapper.sh not found
% which virtualenvwrapper
virtualenvwrapper not found
% find / -path /media -prune -o -name virtualenvwrapper.sh
/media
% dpkg-query -L virtualenvwrapper | grep 'virtualenvwrapper\.sh'
% sudo apt-get install virtualenvwrapper
Reading package lists...
Building dependency tree...
Reading state information...
virtualenvwrapper is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Run Code Online (Sandbox Code Playgroud)

我已经没有什么可以尝试的了:apt-getvirtualenvwrapper已经安装,但我在任何virtualenvwrapper.sh地方都找不到任何迹象。

更新:嗯,我刚刚发现该文件

/etc/bash_completion.d/virtualenvwrapper
Run Code Online (Sandbox Code Playgroud)

...看起来很像virtualenvwrapper.sh。我不知道这个文件apt-get在我运行时是否放在那里apt-get install virtualenvwrapper(文件的 mdate 是几个月前的),但如果是,那么我对安排的明显愚蠢感到困惑......首先,不是每个人都使用bash(我碰巧使用zsh)。另一方面,人们可能想virtualenvwrapper.sh在启动以外的时间运行......我确定我在这里遗漏了一些重要的东西,但从表面上看,它的apt-get安装确实看起来很virtualenvwrapper迟钝......无论如何,它浪费了我大约三个小时的时间......

pho*_*bos 41

来自/usr/share/doc/virtualenvwrapper/README.Debian

与信息相反
/usr/share/doc/virtualenvwrapper/en/html/index.html 这个包安装
virtualenvwrapper.sh 作为 /etc/bash_completion.d/virtualenvwrapper。

如果您安装包 bash-completion 和
在 /etc/bash.bashrc 或 ~/.bashrc 中启用 bash 完成支持。

如果您只想使用 virtualenvwrapper,您可以添加

 source /etc/bash_completion.d/virtualenvwrapper

到您的 ~/.bashrc。

是的,有点难找 :D

  • `zsh` 用户呢?太好了,另一个在每个操作系统上表现不同的包。我认为 `sudo apt-get purge virtualenvwrapper` 和 `sudo pip install virtualenvwrapper` 是合适的。 (2认同)

小智 5

在 Ubuntu 上,脚本的位置是:

/usr/share/virtualenvwrapper/virtualenvwrapper.sh
Run Code Online (Sandbox Code Playgroud)

因此,如果您安装了virtualenvwrapper包管理器,则必须将以下行添加到您的~/.bashrc

export WORKON_HOME=~/.virtualenvs
source /usr/share/virtualenvwrapper/virtualenvwrapper.sh
Run Code Online (Sandbox Code Playgroud)

另外,请记住重新加载~/.bashrc

$ source ~/.bashrc
Run Code Online (Sandbox Code Playgroud)

如果一切顺利,那么您将能够mkvirtualenv像这样运行:

mkvirtualenv --python="/usr/bin/python3" venv_name
Run Code Online (Sandbox Code Playgroud)