Mac终端运行:
pip install virtualenv
会报错,提示我们没有权限:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/platformdirs.py'
Consider using the `--user` option or check the permissions.
于是,根据提示,使用 “--user” 继续安装:
pip install virtualenv --user
提示安装成功:
但是,运行命令:
virtualenv testenv
会提示错误:
zsh: command not found: virtualenv
经过一番折腾查找之后,才发现这个是应为没有权限, 要使用sudo安装才行
于是我们先卸载
pip uninstall virtualenv
然后我们安装
sudo pip install virtualenv
这样就可以使用了