pip镜像源+修改linux配置用永久生效 您所在的位置:网站首页 pip更换源linux pip镜像源+修改linux配置用永久生效

pip镜像源+修改linux配置用永久生效

2023-08-16 09:48| 来源: 网络整理| 查看: 265

pip源

清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 华中理工大学:http://pypi.hustunique.com/ 山东理工大学:http://pypi.sdutlinux.org/ 豆瓣:http://pypi.douban.com/simple/

清华镜像官网:https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/

临时使用

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider

一次配置,永远生效 Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)

内容如下:

[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host=mirrors.aliyun.com

windows下,直接在user目录中创建一个pip目录,如:C:\Users\xx\pip,新建文件pip.ini。内容同上。

注意:执行pip的时候 不能在前面加sudo 因为加了sudo就默认是root用户 会到root的主目录下寻找配置文件 而我们的配置文件是写在主用户目录下的。

使用anaconda anaconda也有很多镜像

conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --set show_channel_urls yes

规律 许多国外资源,在国内都有镜像。 比如:

maven仓库 pip仓库 ubuntu仓库 apache仓库

当下载东西缓慢时,考虑更改一下配置,用国内源。

使用现成的whl安装python包 使用pip install 包名命令安装包时,常常会因为编译失败而安装失败。

building ‘twisted.test.raiser’ extension error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: http://landinghub.visualstudio.com/visual-cpp-build-tools 安装scrapy时,需要Visual C++14.0进行编译。想下载VC14.0结果找不到,解决方法: 1、conda install scrapy 试试conda,conda的包源跟pip的包源是不一样的,pip不行,conda可能就行。 2、安装编译完成之后的包 这个链接提供了一些编译好的Python包

以xgboost安装为例,从上述网站上下载xgboost.whl文件,执行pip install xgboost.whl即可安装成功。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有