常用镜像源:
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里:http://mirrors.aliyun.com/pypi/simple/
豆瓣:http://pypi.douban.com/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/
以豆瓣镜像为例,使用如下命令安装你想要的模块:
pip install 模块名 -i http://pypi.douban.com/simple
pip升级到7.0以后,在使用http镜像进行包安装及升级的时候往往会有如下提示:
Collecting beautifulsoup4
The repository located at xxx.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with ‘–trusted-host xxx.com’.
这时候根据提示在最后添加–trusted-host + 镜像官网即可。例如:
pip install 模块名 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
决策树可视需要安装包和插件:pip install graphviz (还需要配置环境)
pip install graphviz
pip install pydotplus
pip install six
import graphviz
import pydotplus
from six import StringIO
为了解决export_graphviz画决策树图时中文乱码的问题,需要使用sklearn.externals.six包里的StringIO
查阅资料后发现sklearn 0.23版本已经删掉了这个包。
因此直接安装six包:
mysql第三方数据库模块
pip install pymysql
import pymysql
科学计算库
pip install numpy
pip install pandas
数据缺失
pip install missingno
import missingno as msno
boosting集成学习
pip install xgboost
pip install lightgbm
import xgboost as xgb
import lightgbm as lgb
语音播放相关
playsound
机器学习深度学习框架
pip install tensorflow
pip install keras
pip3 install torch torchvision torchaudio
注意:安装Pytorch最好进入官网根据自己的需求选择合适的版本
官网:(https://pytorch.org/)
图片相关
pip install scikit-image
结巴分词
pip install jieba
画图
pip install matplotlib
关联规则
pip install apyori
from apyori import apriori
不平衡样本处理
pip install imbalanced-learn
pip install imblearn
使用SMOTE进行过采样
from imblearn.over_sampling import SMOTE
注意:处理不平衡数据集,也可以先SMOTE过采样,再进行下采样
数理统计时间序列
pip install statsmodels
时间序列特征提取
pip install tsfresh