PYTHON通用库一键安装!

· · 个人记录

python通用库一键安装

#一键安装python第三方库
import os # 引用os库
libs = {"numpy","matplotlib","pillow","skleran","requests","h5py" ,"heapdict","html5lib" ,"idna" , "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"} # 将需要安装的库放入字典中
try:
    for lib in libs: #循环遍历字典(从第一个元素到最后一个元素)
        os.system("pip install "+lib)#将列表中的数据和pip install 指令结合然后传入cmd命令行中
    print("Successful") #返回安装信息
except:
    print("Failed Somehow")