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
相关推荐
Java后端的Ai之路4 天前
【Python小知识】-pip install xxx 命令安装的 ,在电脑的哪个盘?
开发语言·python·pip·pip install
gsgbgxp5 天前
安装库是优先用conda还是pip
深度学习·ubuntu·conda·pip
玄同7656 天前
深入理解 SQLAlchemy 的 relationship:让 ORM 关联像 Python 对象一样简单
人工智能·python·sql·conda·fastapi·pip·sqlalchemy
好好学习啊天天向上6 天前
C盘容量不够,python , pip,安装包的位置
linux·python·pip
好好学习啊天天向上7 天前
conda pip更新安装路径,解决C盘容易不够的问题
python·conda·pip·2025yfb3003605
小毅&Nora7 天前
【后端】【Python】① Windows系统下Python环境变量设置指南
python·pip
理智.6299 天前
根据requirements.txt 完成环境中的依赖库导入
python·conda·pip
万粉变现经纪人9 天前
如何解决 pip install pyodbc 报错 缺少 ‘cl.exe’ 或 ‘sql.h’(ODBC 头文件)问题
数据库·python·sql·网络协议·bug·ssl·pip
AlenTech10 天前
如何解决Ubuntu中使用系统pip报错的问题,error: externally-managed-environment
linux·ubuntu·pip
C系语言10 天前
python用pip生成requirements.txt
开发语言·python·pip