且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

虚拟环境"workon"不起作用

更新时间:2023-11-09 20:28:04

由于我没有足够的声誉来发表评论,因此我将尝试尝试一个答案,因为我认为我知道问题出在哪里.

Since I don't have enough reputation to comment I'll simply attempt an answer as I think I know what the issue is.

首先,如果您可以提供更多有关不工作"的含义的详细信息,我将在需要时编辑我的答案,并尝试提供更多帮助.

Firstly, if you could provide more details as to what you mean by "not working" I will edit my answer if need be and attempt to help more.

通常发生这种情况是因为virtualenvwrapper是一个shell脚本,在您访问"workon"和"mkvirtualenv"之类的命令之前,需要先获取该脚本.我的 virtualenvwrapper.sh 脚本安装在/usr/local/bin 中,因此我只需运行:

Typically this happens because virtualenvwrapper is a shell script that needs to be sourced before you have access to commands like "workon" and "mkvirtualenv". My virtualenvwrapper.sh script is installed in /usr/local/bin so I simply run:

$源/usr/local/bin/virtualenvwrapper.sh

通常我将此行添加到我的〜/.bashrc 〜/.profile 文件中,以确保这些命令在Shell中始终可用.您可以在安装文档中找到有关设置的更多特定信息.没有源文件肯定会导致命令在关闭后停止工作.

Typically I add this line to my ~/.bashrc or ~/.profile file to ensure these commands are always available in the shell. You can find more specific information for your setup in the Installation Documentation. Not having it sourced would definitely cause the commands to stop working after a shutdown.