python一键安装多个库

常用python库(新建个txt文件把下面的复制进去):
h5py, heapdict, html5lib, idna, 2.6imageio, imagesize, imshow, intervaltree, ipykernel, ipython, ipython-genutils, ipywidgets, isort,itchat, itsdangerous, jdcal,jedi,Jinja2, jsonschema, jupyter, jupyter-client, jupyter-console, jupyter-core, jupyterlab,jupyterlab-launcher, Keras,Keras-Applications, Keras-Preprocessing, lazy-object-proxy,line, llvmlite, lml, locket, lockfile, lxml, make-dataset, Markdown, MarkupSafe, matplotlib, mccabe, menuinst, mistune, mpmath, msgpack-python, multipledispatch, MyQR, navigator-updater,nbconvert, nbformat, networkx, nltk,
nose,notebook, numba,numexpr, numpy,numpydoc, oauthlib, odo, olefile, opencv-contrib-python, opencv-python, openpyxl, opt-einsum, overlap, packaging, pandas, pandocfilters,
partd,path.py,pathlib2, patsy,pep8, pickleshare,Pillow, pip, pkginfo, ply, post, prettytable,progress, prompt-toolkit, protobuf, psutil, py, pyasn1, pyasn1-modules, pycodestyle,pycosat,
pycparser, pycrypto, pycurl, pyecharts, pyecharts-jupyter-installer, pyflakes, Pygments, pygubu, pylint, PyMySQL, pyodbc, pyOpenSSL, pyparsing, pypng,PyQRCode, PyQt5,PyQt5-sip, PySocks, pytest, python-dateutil, pytz, PyWavelets,pywin32, PyYAML, pyzmq,QtAwesome, qtconsole, QtPy, requests, requests-oauthlib,rope, rsa, ruamel-yaml,scikit-image, scikit-learn, scipy,seaborn, setuptools, shape,simplegeneric, simplejson, singledispatch, sip, six, sklearn, snowballstemmer, sortedcollections,sortedcontainers, Sphinx, sphinxcontrib-websupport, split,
spyder, SQLAlchemy, sqlparse, statsmodels,sympy,tables, tag, tblib,tensorboard,testpath, thrift, tkinter-nav,toolz,tornado,train,traitlets,typing,unicodecsv,urllib3,wcwidth,webencodings,Werkzeug, wheel,widgetsnbextension,win-inet-pton, win-unicode-console, wincertstore,wordcloud,wrapt,wxpy,xlrd,
XlsxWriter,xlutils,xlwings,xlwt, zict
-------------到此为止----------------
在用户文件夹新建个pip文件夹
再在pip文件夹新建个pip.ini,写入:
[global]
index-url = http://pypi.douban.com/simple
[install]
trusted-host=pypi.douban.com
保存好,以后下载python库就会默认使用该镜像,速度很快!!
python一键安装多个库_第1张图片
下面就是一键安装python库的代码了

import os
import re
def getTxt():
        txt = open("支持库.txt","r").read()#读取需要安装的第三方库
        return txt
kusTxt=getTxt()
words=kusTxt.split(',')
for word in words:
    os.system("pip  install  " +  str(word))
    print("{}成功安装".format(word))

你可能感兴趣的:(python)