第一下載好pip後,使用pip install ipython的使用出現了一個錯誤python
permission denied:
而後使用bash
sudo pip install ipython
出現的問題:url
Installing collected packages: setuptools Found existing installation: setuptools 1.1.6 Uninstalling setuptools-1.1.6: Exception:
若是你也遇到了同樣的問題,我給出個人解決方案
第一步:將已經安裝的pip卸載(若是是使用sudo下載的,卸載的時候也要加一個sudo)code
pip uninstall pip
第二步:安裝pip,這個方法是官方推薦的,get-pip.py文件請去pip的官網下載ip
python get-pip.py --user
第三步:打開.bash_profile文件(但願你知道.bash_profile文件在哪裏),將一下代碼添加到末尾。這樣的作的目的是能夠使用你能夠使用本用戶下的pip,而不是調用全局的pipterminal
if [ -d $HOME/Library/Python/2.7/bin ]; then export PATH=$HOME/Library/Python/2.7/bin:$PATH fi
第四步:保存.bash_profile文件get
source .bash_profile
第五步:配置一下pip的參數it
cd ~ mkdir -p .pip touch ./pip/pip.conf
第六步:在建立的pip.conf文件寫入pip
[global] default-timeout = 60 download-cache = ~/.pip/cache log-file = ~/.pip/pip.log [install] index-url = https://pypi.douban.com/simple
OK,如今已經能夠了,不過下載的使用你須要添加--user參數,表示只在本用戶下安裝,不影響別的用戶io
pip install ipython --user
最後,我仍是須要提醒一個地方,你的terminal或者是iterm若是默認使用的bash,那麼你每次啓動的時候.bash_profile會自動執行,若是你是使用別的,好比我是使用zsh,那麼就須要在.zshrc文件的末尾添加:
if [ -d $HOME/Library/Python/2.7/bin ]; then export PATH=$HOME/Library/Python/2.7/bin:$PATH fi