如何使用Python离线安装特定模块的whl文件?

2026-05-16 10:401阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计246个文字,预计阅读时间需要1分钟。

如何使用Python离线安装特定模块的whl文件?

下载whl格式的模块,进入模块所在目录,例如我的模块下载在D:\Pythonwork。进入模块所在目录:D:\Pythonwork。安装模块:pip install XXX.whl。安装结果:D:\Pythonwork\pip install pygame-2.1.2-cp37-cp37m-win_amd64.whl,成功安装。

下载whl格式的模块,进入模块的目录,比如我的模块下载在D:\Pythonwork

1.进入模块所在目录

D:

cd D:\Pythonwork

2.安装模块pip install XXX.whl

如何使用Python离线安装特定模块的whl文件?

D:\Pythonwork>pip install pygame-2.1.2-cp37-cp37m-win_amd64.whl

Processing d:\pythonwork\pygame-2.1.2-cp37-cp37m-win_amd64.whl

Installing collected packages: pygame

Successfully installed pygame-2.1.2


要注意python版本与模块的版本对应关系,比如我的python是3.7,windows系统,64位,那么pygame是cp37,win_amd64

查看python版本命令。否则可能提示.whl is not a supported wheel on this platform.

D:\Pythonwork>python

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32

本文共计246个文字,预计阅读时间需要1分钟。

如何使用Python离线安装特定模块的whl文件?

下载whl格式的模块,进入模块所在目录,例如我的模块下载在D:\Pythonwork。进入模块所在目录:D:\Pythonwork。安装模块:pip install XXX.whl。安装结果:D:\Pythonwork\pip install pygame-2.1.2-cp37-cp37m-win_amd64.whl,成功安装。

下载whl格式的模块,进入模块的目录,比如我的模块下载在D:\Pythonwork

1.进入模块所在目录

D:

cd D:\Pythonwork

2.安装模块pip install XXX.whl

如何使用Python离线安装特定模块的whl文件?

D:\Pythonwork>pip install pygame-2.1.2-cp37-cp37m-win_amd64.whl

Processing d:\pythonwork\pygame-2.1.2-cp37-cp37m-win_amd64.whl

Installing collected packages: pygame

Successfully installed pygame-2.1.2


要注意python版本与模块的版本对应关系,比如我的python是3.7,windows系统,64位,那么pygame是cp37,win_amd64

查看python版本命令。否则可能提示.whl is not a supported wheel on this platform.

D:\Pythonwork>python

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32