在deepin20系统中使用pip安装virtualenv环境后,最后提示如下:
zhj001@zhj001-PC:~$ pip install virtualenv
Successfully built filelock
Installing collected packages: configparser, contextlib2, zipp, importlib-metadata, appdirs, typing, singledispatch, importlib-resources, distlib, filelock, virtualenv
The script virtualenv is installed in '/home/zhj001/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed appdirs-1.4.4 configparser-4.0.2 contextlib2-0.6.0.post1 distlib-0.3.2 filelock-3.0.12 importlib-metadata-2.1.1 importlib-resources-3.3.1 singledispatch-3.6.2 typing-3.10.0.0 virtualenv-20.4.7 zipp-1.2.0
可以看出是virtualenv可执行文件的路径是/home/zhj001/.local/bin,并没有在环境变量里,所以无法直接执行virtualenv这个命令,我们需要将virtualenv这个安装目录放到环境变量PATH中,所以解决办法如下:
zhj001@zhj001-PC:~$ echo 'export PATH=/home/zhj001/.local/bin:$PATH' >> ~/.bashrc
zhj001@zhj001-PC:~$ source ~/.bashrc
这样就可以解决问题了。