pip安装第三方库太慢
1、终端或控制台中最好解决办法:
pip install 库名 -i 国内镜像源
例如:
# 使用清华镜像源
pip install Django -i https://pypi.tuna.tsinghua.edu.cn/simple
# 使用豆瓣镜像源
pip install Django -i http://pypi.douban.com/simple/
# 使用阿里镜像源
pip install Django -i http://mirrors.aliyun.com/pypi/simple/
2、pycharm中最好解决方法
按照图中顺序配置国内镜像源,即可。
pip安装失败
python -m pip install -U --force-reinstall pip install django
pip install -r requirement.txt安装慢
linux系统永久配置快速安装
# 创建.pip文件夹
mkdir ~/.pip
cd ~/.pip
# 创建pip.conf文件
touch pip.conf
sudo vi ~/.pip/pip.conf
# 将以下内容增加到pip.conf文件中
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
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
即可添加 Anaconda Python 免费仓库。
直接粘贴复制以上代码即可。另外,要一行一行运行,并且每一行运行完没有任何结果,直接运行下一行即可。
三行代码运行完,可以运行 conda install numpy 测试一下吧。