pip安装第三方库与设置

pip的使用

假如下载numpy

shell 复制代码
pip install numpy

pypi 镜像源「配置」

常用镜像源列表

text 复制代码
官方:https://pypi.org/simple
百度:https://mirror.baidu.com/pypi/simple/
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里:https://mirrors.aliyun.com/pypi/simple/
豆瓣:https://pypi.douban.com/simple/
中科大:https://pypi.mirrors.ustc.edu.cn/simple/

1、临时使用

bash 复制代码
pip install xxxxx -i https://mirror.baidu.com/pypi/simple/ 

2、长期设置

text 复制代码
pip config set global.index-url https://mirror.baidu.com/pypi/simple/

注:升级 pip 到最新的版本 (>=10.0.0) 后进行配置,详见

3、配置多个镜像源(负载均衡)

text 复制代码
pip config set global.extra-index-url "<url1> <url2>..."

pip升级

python -m pip install --upgrade pip

手动安装pip依赖库

所有conda安装的环境路径

E:\Anaconda3-2019.10-Windows-x86_64\envs

某环境中pip安装的第三方库位置:
E:\Anaconda3-2019.10-Windows-x86_64\envs\tensorflow-gpu\Lib\site-packages

bug

解决Win下使用.bat时conda activate python虚拟环境无效的问题

直接使用<虚拟坏境路径>/python.exe main.py

bug:sklearn通过pip下载后无法导入的情况

description:

When execute code:
import sklearn

Exception output:

from .qhnll import *

ImportError: DLL load failed:找不到指定的模块。
solution:

shell 复制代码
pip install mkl
pip install --user --ignore-installed scikit-learn
相关推荐
hui函数4 小时前
如何解决 pip install 编译报错 ‘cl.exe’ not found(缺少 VS C++ 工具集)问题
开发语言·c++·pip
hui函数6 小时前
Python系列Bug修复|如何解决 pip install 安装报错 invalid command ‘bdist_wheel’(缺少 wheel)问题
python·bug·pip
hui函数6 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 私有索引未设为 trusted-host 导致拒绝 问题
python·bug·pip
hui函数7 小时前
Python系列Bug修复|如何解决 pip install 安装报错 Backend ‘setuptools.build_meta’ 不可用 问题
python·bug·pip
hui函数8 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 私有仓库认证失败 401 Unauthorized 问题
python·bug·pip
hui函数8 小时前
Python系列Bug修复|如何解决 pip install -r requirements.txt 子目录可编辑安装缺少 pyproject.toml 问题
python·bug·pip
hui函数1 天前
如何解决 pip install 编译报错 g++: command not found(缺少 C++ 编译器)问题
开发语言·c++·pip
hui函数1 天前
Python系列Bug修复|如何解决 pip install -e . 安装报错 “后端不支持可编辑安装(PEP 660)” 问题
python·bug·pip
hui函数1 天前
如何解决 pip install 网络报错 403 Forbidden(访问被阻止)问题
网络·pip
一尘之中1 天前
在Ubuntu 22.04中高效使用pip:从入门到精通
ubuntu·pip·ai写作