Python pip使用国内镜像安装第三方库:命令行或PyCharm 您所在的位置:网站首页 pil库安装指令 Python pip使用国内镜像安装第三方库:命令行或PyCharm

Python pip使用国内镜像安装第三方库:命令行或PyCharm

2024-07-15 07:01| 来源: 网络整理| 查看: 265

文章目录 国内镜像其他命令设置全局镜像多个源判断系统不使用缓存安装pytorch查看某包所需依赖参考文献

亲测豆瓣源更快

国内镜像

命令行:

pip install ××× -i https://pypi.tuna.tsinghua.edu.cn/simple pip install ××× -i https://pypi.doubanio.com/simple/

PyCharm:

https://pypi.tuna.tsinghua.edu.cn/simple https://pypi.doubanio.com/simple/

默认官方源为:https://pypi.python.org/simple

其他命令 升级:pip install --upgrade 库名 或 pip install -U 库名指定版本:pip install scipy==0.15.1查看某个库版本:pip list | grep numpy查看某个库可安装版本:pip search numpy 或 pip install numpy==查询某个库的详细内容:pip show numpy延长超时时间:pip install --default-timeout=100 批量安装:pip install -r requirements.txt强制安装指定版本:pip install tensorflow==1.14.0 keras==2.2.4 tensorflowjs==0.6.4 --force-reinstall查看pip所有命令:pip install -h跳过requirements.txt安装:pip install tflite-model-maker --no-deps删除所有库:pip freeze > requirements.txt 然后 pip uninstall -r requirements.txt -y

设置全局镜像

步骤:

新建文件夹 C:\Users\Administrator\pip创建文件 pip.ini输入内容 [global] index-url=https://pypi.tuna.tsinghua.edu.cn/simple/ [install] trusted-host=pypi.tuna.tsinghua.edu.cn

或用豆瓣源

[global] index-url=https://pypi.doubanio.com/simple/ [install] trusted-host=pypi.doubanio.com

或直接执行命令:pip config set global.index-url https://pypi.doubanio.com/simple/

多个源

如公司内部自建的包

[global] index-url=https://pypi.doubanio.com/simple/ extra-index-url= http://mirrors.aliyun.com/pypi/simple [install] trusted-host= pypi.doubanio.com mirrors.aliyun.com

判断系统 uvloop==0.14.0;platform_system=="Linux" python-magic-bin==0.4.14;platform_system=="Windows"

不使用缓存安装

添加参数--no-cache-dir

查看缓存目录:pip cache dir

Windows缓存目录:%LocalAppData%\pip\Cache

Linux缓存目录: ~/.cache/pip

macOS缓存目录: ~/Library/Caches/pip

pytorch pip install ××× -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.doubanio.com/simple/

查看某包所需依赖 pip show xxx

参考文献 pip官方文档pip配置文件pip缓存pypi | 镜像站使用帮助Windows 下 Python pip 配置多个源的方法pip 使用小抄Python requirements.txt 语法


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

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