[英]Getting "`mkvirtualenv: command not found`" after installing virtualenvwrapper on Ubuntu 20.04
On Ubuntu v20.04 , I have just installed virtualenv
and virtualenvwrapper
using apt
with the commands:在 Ubuntu v20.04 上,我刚刚使用
apt
和命令安装了virtualenv
和virtualenvwrapper
:
sudo apt install virtualenv
sudo apt install virtualenvwrapper
I did not get any errors or warnings.我没有收到任何错误或警告。
When I try to run mkvirtualenv
, which is claimed to be in virtualenvwrapper
, I get:当我尝试运行据称位于
virtualenvwrapper
中的mkvirtualenv
时,我得到:
mkvirtualenv: command not found
This question presents an old solution (from 8 years ago) consisting of locating the file virtualenvwrapper.sh
and adding it to the source. 这个问题提出了一个旧的解决方案(8 年前),包括找到文件
virtualenvwrapper.sh
并将其添加到源代码中。
However, this doesn't work anymore.但是,这不再起作用了。 When I type
source "/usr/bin/virtualenvwrapper.sh"
, I get当我输入
source "/usr/bin/virtualenvwrapper.sh"
时,我得到
bash: /usr/bin/virtualenvwrapper.sh: No such file or directory
When I use locate
or find
to search for this file throughout the computer, I get no results.当我使用
locate
或find
在整个计算机中搜索此文件时,我没有得到任何结果。 When I type which virtualenvwrapper
I get no result.当我输入
which virtualenvwrapper
时,我没有得到任何结果。
Trying to re-install the module again, I get:尝试再次重新安装模块,我得到:
sudo apt install virtualenvwrapper
Reading package lists... Done
Building dependency tree
Reading state information... Done
virtualenvwrapper is already the newest version (4.8.4-4).
0 to upgrade, 0 to newly install, 0 to remove and 18 not to upgrade.
What to do?该怎么办?
User phd comments that mkvirtualenv
is not an executable, it's a shell function provided by virtualenvwrapper.sh
.用户phd评论说
mkvirtualenv
不是可执行文件,它是由virtualenvwrapper.sh
提供的 shell function。 But if you don't know that to begin with, how would you find out?但如果你一开始就不知道,你怎么知道呢? Some tips:
一些技巧:
Perhaps the executable name itself ( " mkvirtualenv
" ) is incorrect.也许可执行文件名称本身 ( "
mkvirtualenv
" ) 不正确。 On my system, where neither package, virtualenv or virtualenvwrapper , is installed, if the user attempts to run any program name that's not installed but could be installed, the command-not-found package will print an error message showing what package might need to be installed.在我的系统上,没有安装 package、 virtualenv或virtualenvwrapper ,如果用户尝试运行任何未安装但可以安装的程序名称, command-not-found package将打印一条错误消息,显示 package 可能需要什么被安装。
It works even with similar sounding names -- so if we run a nonexistent command:它甚至可以使用相似的发音名称——所以如果我们运行一个不存在的命令:
bbash
The output is: output 是:
Command 'bbash' not found, did you mean: command 'bash' from deb bash (5.0-6ubuntu1.1) command 'rbash' from deb bash (5.0-6ubuntu1.1) Try: apt install <deb name>
But if, on Linux Mint 20 , I run the executable name given in the question:但是,如果在Linux Mint 20上,我运行问题中给出的可执行文件名称:
mkvirtualenv
The output is: output 是:
mkvirtualenv: command not found
...which implies such a command isn't even installable. ...这意味着这样的命令甚至无法安装。
To find out the actual names and paths of programs installed with a given package that's already been installed on your system, use dlocate -lsbin...
, like so:要找出系统上已安装的给定 package 安装程序的实际名称和路径,请使用
dlocate -lsbin...
,如下所示:
dlocate -lsbin virtualenv virtualenvwrapper
To find the name of a not installed package containing a known file name, use apt-file
:要查找包含已知文件名的未安装 package 的名称,请使用
apt-file
:
apt-file find virtualenv
...which finds the string "virtualenv" in the pathnames of all installable packages. ...在所有可安装包的路径名中找到字符串“virtualenv” 。
To narrow the list to only file basenames that include the string "virtualenv" , do:要将列表缩小到仅包含字符串"virtualenv"的文件基本名称,请执行以下操作:
f=virtualenv apt-file find $f | grep '[^/]*'"$f"'[^/]*$'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.