python安装库时遇到的各类问题
1.更新pip失败的解决方案
如果提示失败如下:
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
可以用管理员身份运行windows shell 然后输入:
python3 -m pip install -U --force-reinstall pip
2.安装依赖包被墙
更换pip源,可解决被抢导致第三方库装不上的烦恼。
豆瓣镜像源 http://pypi.douban.com/simple/
清华镜像源 https://pypi.tuna.tsinghua.edu.cn/simple
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
pip版:
具体实现:(临时使用)以清华镜像源为例可以在使用pip的时候加参数 -i https://pypi.tuna.tsinghua.edu.cn/simple,例如
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple numpy
conda版:
#为conda添加清华镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
conda config --set show_channel_urls yes
还原默认源:
conda config --remove-key channels