开始探索Python并想开始在虚拟环境中玩耍。我是macOS用户。
这是我的默认python版本:
$ python --version
Python 3.7.2
这是我尝试使用pip安装virtualenv时看到的内容:
$ pip install virtualenv
Collecting virtualenv
Using cached https://files.pythonhosted.org/packages/7e/1b/6c00d57127608793e16e8b7f813e64d58a1938505c42fe190d1386ab41e1/virtualenv-16.4.0-py2.py3-none-any.whl
Installing collected packages: virtualenv
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/bin/virtualenv'
Consider using the `--user` option or check the permissions.
$ pip install virtualenv
Requirement already satisfied: virtualenv in /usr/local/lib/python2.7/site-packages (16.4.0)
我可以从最后的输出中了解到virtualenv已安装用于python2.7,但我需要3.7.2。如何做到这一点?
当我将Could not install packages . . .
错误明确地安装到其他地方(??)时,也会误导我。
TIA!
$ pip3 --version
-bash: pip3: command not found
$ brew install pip3
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
imagemagick scipy
Error: No available formula with the name "pip3"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.