我开始学习 Django 框架,所以我需要在我的 mac 上安装最新的 python、pip、virtualenv 和 django 包。我尝试用brew来做到这一点,但我得到了一些奇怪的行为。
首先,python3没有安装在/usr/bin/中,而是安装在/Library/Frameworks/Python.framework目录中:
$ which python
/usr/bin/python
$ which python3
/Library/Frameworks/Python.framework/Versions/3.7/bin/python3
Run Code Online (Sandbox Code Playgroud)
这对我来说很奇怪,因为每个教程都讲述了 /usr/bin/python37 而没有讲述 /Library/Frameworks/Python.framework 这样可以吗?
之后我做出sudo pip3 install virtualenv并得到了这个答案:
The directory '/Users/user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/user/Library/Caches/pip' or its parent directory is not owned by …Run Code Online (Sandbox Code Playgroud)