首页 > 编程语言 >离线安装Python包

离线安装Python包

时间:2023-01-08 17:56:49浏览次数:61  
标签:Python 离线 -- pygame pip packages 安装

起因

需要在一台联网的计算机和一台不联网的计算机上安装 Python 包。

pygame 在线安装失败

在 CMD 命令行运行下列命令安装 pygame:
python -m pip install --user pygamepip install pygame

超时安装失败!

离线安装 pygame

通过博文找到离线下载地址:https://pypi.org/project/pygame/#files

下载后通过以下命令安装:pip install pygame-***-win_amd64.whl

但尝试了几个以 win_amd64.whl 结尾的包均以失败告终。

通过博文了解到可通过 pip debug --verbose 命令查看 .whl 包的规范命名。

我安装的是 Python3.11,使用的是 win64 位系统,查看到的规范命名是:

Compatible tags: 39
  cp311-cp311-win_amd64

相关规范名称的包在 pypi.org 上找不到!

后来在 GitHub 上找到了下载地址:https://github.com/pygame/pygame/releases

原来支持 Python3.11 的 pygame 上属于预览版:
https://github.com/pygame/pygame/releases/download/2.1.3.dev8/pygame-2.1.3.dev8-cp311-cp311-win_amd64.whl

使用以下命令离线安装成功:pip install pygame-2.1.3.dev8-cp311-cp311-win_amd64.whl

离线安装 matplotlib

然而在matplotlib官网和GitHub并未找到离线安装包,但找到一个非官方下载的站点:https://www.lfd.uci.edu/~gohlke/pythonlibs/

可以下载到兼容 Python3.11 的包,但不是最新版的 matplotlib。

安装 plotly

plotly官网、Github、及上述离线下载站点均未找到离线安装包。

使用 pip --help 查看帮助,可使用 timeout 避免下载超时失败:

pip install plotly==5.11.0 --timeout 100

pip --help

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  inspect                     Inspect the python environment.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  cache                       Inspect and manage pip's wheel cache.
  index                       Inspect information available from package indexes.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  debug                       Show information useful for debugging.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --debug                     Let unhandled exceptions propagate outside the main subroutine, instead of logging them
                              to stderr.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  --require-virtualenv        Allow pip to only run in a virtual environment; exit with an error otherwise.
  --python <python>           Run pip with the specified Python interpreter.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to
                              WARNING, ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --no-input                  Disable prompting for input.
  --proxy <proxy>             Specify a proxy in the form scheme://[user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup,
                              (a)bort.
  --trusted-host <hostname>   Mark this host or host:port pair as trusted, even though it does not have valid or any
                              HTTPS.
  --cert <path>               Path to PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL
                              Certificate Verification' in pip documentation for more information.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the
                              certificate in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is available for
                              download. Implied with --no-index.
  --no-color                  Suppress colored output.
  --no-python-version-warning
                              Silence deprecation warnings for upcoming unsupported Pythons.
  --use-feature <feature>     Enable new functionality, that may be backward incompatible.
  --use-deprecated <feature>  Enable deprecated functionality, that will be removed in the future.

在线安装 plotly 过程中,使用 Everything 搜索,plotly*.whl,查找到 Temp 文件夹下存在名称为 plotly-5.11.0-py2.py3-none-any.whl 的文件,在下载完成后安装前复制该文件(安装完成后该文件将自动删除)即可得到离线安装包。

标签:Python,离线,--,pygame,pip,packages,安装
From: https://www.cnblogs.com/x2009/p/17034981.html

相关文章

  • python爬虫
    信息表示方式Python库静态网页urlib、requests、BeautifulSoup、re动态网页Selenium和PhantomJS爬虫框架Scrapy数据存储CSV文件、TXT文本或JSON......
  • Python接口自动化系列- python+unittest+ddt参数化7
    一、ddt说明一般进行接口测试时,每个接口的传参都不止一种情况,一般会考虑正向、逆向等多种组合。所以在测试一个接口时通常会编写多条case,而这些case除了传参不同外,其实并......
  • P3_注册小程序账号&安装开发者工具
    注册小程序账号点击注册按钮使用浏览器打开 https://mp.weixin.qq.com/网址,点击右上角的“立即注册”即可进入到小程序开发账号的注册流程,主要流程截图如下:选择注册......
  • 安装谷歌浏览器WebDriver
    安装谷歌浏览器WebDriver​ WebDriver是一个W3C规范,用于定义控制浏览器的API;只要某款浏览器实现了WebDriverAPI,就可以使用Selenium控制这款浏览器;所以安装WebDri......
  • Python中 re.compile 函数的使用
    以下介绍在python的re模块中怎样应用正则表达式1.使用re.compilere模块中包含一个重要函数是compile(pattern[,flags]),该函数根据包含的正则表达式的字符串创建模式......
  • Python基础中的基础:基本运算符的用法
    1算术运算符算术运算符只能用来将同数据类型的进行计算salary=3.3res=salary*12print(10+1)#11print(10-3)#7print(10*3)#30print(10/3)......
  • Python深浅拷贝的理解
    1.拷贝拷贝实际上其实就是在赋值,比如我们有一个列表L1,定义另一个列表L2引用列表L1,实际上就是在拷贝列表L1的值,由于由于L1列表是可变的数据类型,所以当L1的值变的时候,L2的值......
  • Python笔记——字符串(Python编程:从入门到实践)
    字符串一、使用方法修改字符串大小写1.方法:变量.tittle():首字母大学显示字符串中的每个英文单词2.方法:变量.upper():字符串全改为大写3.方法:变量.lower():将字符串全......
  • Mysql安装和卸载(压缩包)
    安装流程命令概览//Createthedefaultdatabaseandexit.Createasuperuserwithemptypassword.mysqld--initialize-insecure//Installthedefaultservi......
  • python使用ntp动态校正时间
    使用ntpudp链接服务器(例如:ntp2.aliyun.com),端口为123,发送48bytes(第一字节为0x1b,后面为0),接收48bytes,解析即可.代码如下:importsocketimportstructimpor......