您的位置:首页 > 编程语言 > Python开发

python-配置国内下载镜像

2017-05-15 16:18 337 查看
anaconda

conda clean --lock
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/[/code] 
pypi

pip3 install -i https://pypi.doubanio.com/simple/ selenium
pip install 你要下载的包 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com http://mirrors.aliyun.com/pypi/simple/ pip install 你要下载的包 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host pypi.douban.com
pip install 你要下载的包 -i https://pypi.mirrors.ustc.edu.cn/simple/  --trusted-host pypi.douban.com
pip install 你要下载的包 -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.douban.com
pip install 你要下载的包 -i http://pypi.mirrors.ustc.edu.cn/simple/ --trusted-host pypi.douban.com


永久配置:

linux的文件在~/.pip/pip.conf,

windows在%HOMEPATH%\pip\pip.ini),

[global]

index-url = http://pypi.douban.com/simple

[install]

trusted-host=pypi.douban.com

脚本:

#!/usr/bin/python
import os
package = raw_input("Please input the package which you want to install!\n")
command = "pip install %s -i http://pypi.mirrors.ustc.edu.cn/simple --trusted-host pypi.mirrors.ustc.edu.cn" % package
os.system(command)


easy

easy_install -i https://pypi.doubanio.com/simple/ selenium
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: