Mac系統(tǒng)都自帶Python環(huán)境,我的是Python2,后面我又自己裝了Python3斩萌。然后安裝requests庫缝裤。執(zhí)行
sudo pip install requests
發(fā)現(xiàn)安裝失敗屏轰,報錯
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
報錯原因我猜測是未找到合適的requests 版本,可能requests只支持Python3了
執(zhí)行
sudo pip3 install requests
安裝成功
此時還遇到一個警告:
The directory '/Users/encircle/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.
按照提示提示加上 -H標(biāo)志就好了
sudo -H pip3 install requests