Python 模块的安装与卸载

使用pip命令

如果系统有多个版本使用相应的pip版本删除对应的python版本的模块

如python2.7 使用pip   python3.0以上使用pip3

安装模块:

pip install 模块名  python3版本使用 pip3 install 模块名

如安装python3版本的pygame

xubin@xubindeMBP:~/Python$ pip3 install pygame
Collecting pygame
  Using cached https://files.pythonhosted.org/packages/b9/89/aca02f8771727c2713c11a39c1cc295e4deb60be322be19ad7460570f978/pygame-1.9.4-cp37-cp37m-macosx_10_11_intel.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.4

卸载模块:

pip uninstall 模块名 python3版本使用 pip3 uninstall 模块名

如卸载python3版本中的pygame

xubin@xubindeMBP:~/Python$ pip3 uninstall pygame
Uninstalling pygame-1.9.4:
  Would remove:
    /usr/local/include/python3.7m/pygame/_camera.h
    /usr/local/include/python3.7m/pygame/_pygame.h
    /usr/local/include/python3.7m/pygame/_surface.h
    /usr/local/include/python3.7m/pygame/bitmask.h
    /usr/local/include/python3.7m/pygame/camera.h
    /usr/local/include/python3.7m/pygame/fastevents.h
    /usr/local/include/python3.7m/pygame/font.h
    /usr/local/include/python3.7m/pygame/freetype.h
    /usr/local/include/python3.7m/pygame/mask.h
    /usr/local/include/python3.7m/pygame/mixer.h
    /usr/local/include/python3.7m/pygame/pgarrinter.h
    /usr/local/include/python3.7m/pygame/pgbufferproxy.h
    /usr/local/include/python3.7m/pygame/pgcompat.h
    /usr/local/include/python3.7m/pygame/pgopengl.h
    /usr/local/include/python3.7m/pygame/pygame.h
    /usr/local/include/python3.7m/pygame/scrap.h
    /usr/local/include/python3.7m/pygame/surface.h
    /usr/local/lib/python3.7/site-packages/pygame-1.9.4.dist-info/*
    /usr/local/lib/python3.7/site-packages/pygame/*
Proceed (y/n)? y
  Successfully uninstalled pygame-1.9.4

 

你可能感兴趣的:(Python,python,pip)