編譯源代碼的方式安裝,在最後執行sudo make install的時候,出現如下警告
The directory '/home/fkjava/.cache/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 '/home/fkjava/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
出現這個警告的原因很簡單:在用戶目錄下的~/.cache/pip/http和~/.cache/pip兩個目錄或者它的上級目錄擁有者,不是root用戶引起的。因爲使用了sudo執行,所以其實這些緩存文件應該在root用戶的Home目錄裏面的。
此時此刻,我們需要在sudo後面加上-H參數即可,就會在執行sudo的時候,把HOME變量的值改爲root的Home目錄。
最終執行命令爲:sudo -H make install
來源:http://www.crazyit.org/forum.php?mod=viewthread&tid=12440