热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

SupportedCPythonversions,installationmethods?

Firstofall,whatversionsofPythonaresupported?

First of all, what versions of Python are supported?

1
pre-commit

is being tested against a bunch of Python versions here. Assuming that declares the supported Python versions, any reason to keep supporting Python 2.6?

In current Python 2.7.z and 3.y,

1
pip

should be available. This brings me to my main question.
The ‘Non-Administrative Installation’ and ‘System Level Install’ sections in the manual are not conventional as they stand. Why not these instructions instead:

1
2
3
 sh

python -m 'ensurepip' --user

python -m 'pip' --user 'pre-commit'

The current instructions could be construed as a security risk (

1
http://

scheme, fetch of a script from your website instead of from a curated package index) and the extra customer installer script

1
install-local.py

requires maintenance.

该提问来源于开源项目:pre-commit/pre-commit

Okay, interesting note about the user site-packages dir conflicting with the Python path. I hope you're fine with discussing this further to at least achieve a common understanding.



Based on my current knowledge, I think adding the user site-packages dir to the Python path is a fine design choice for non-isolated virtual environments. Why would it be a problem? Virtualenvs are a hack actually. But most importantly, I could not reproduce this issue in an isolated venv, didn't test it in a non-isolated one.

1
2
3
4
 sh

python -m venv /tmp/myvenv

. /tmp/myvenv/bin/activate

(myvenv) python -c 'from sys import path; print(path)'

1
2
 python

['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-linux', '/usr/lib/python3.5/lib-dynload', '/tmp/myvenv/lib/python3.5/site-packages']

Really, I think the Node.js shop argument is not very good. I do not see why it would be more difficult or unattractive to issue one or two very plain command line statements vs. one (slightly more complex). Also, the




1
curl

dependency of the current instructions won't be available on Windows by default and needs to be installed on the CI host.

It's still okay if you think asking to install one or two OS packages on Debian makes things too difficult, but didn't I propose to reserve the special instructions (meaning, even if just the current ones) for Debian? At least, that would not suggest to users that

1
pre-commit

should always be installed in the unconventional (in my view, unattractive for the reasons stated) way. Also,

1
npm

as known by the Node.js peeps works in the same way, also installing deps under the user home directory. The same is true for many other language impl dep managers. And on a final note, I'd say

1
pip

itself is fairly well-known by anyone who ever did anything with CPython, even for some end-user use cases.

I agree that it's attractive to just fire off a script and that sorts out everything for installation. The problem is, this fails in a bare Alpine Linux Docker container, i.e. a common CI host, with cryptic error messages. That's related to #396, and not a problem per se. What I am getting at is that the benefits of keeping your script/custom installation commands that you feel do not bear out in practice for me.


   



推荐阅读
  • 在Python 2.7环境中使用PyCharm进行Cvxopt的安装及线性规划问题求解。具体步骤包括:通过PyCharm的文件菜单进入项目设置,选择解释器选项,点击右侧的“+”按钮,在可用包列表中搜索并安装Cvxopt。安装完成后,可以通过导入Cvxopt库并调用其函数来解决线性规划问题,提高模型的准确性和效率。 ... [详细]
  • Python处理Word文档的高效技巧
    本文详细介绍了如何使用Python处理Word文档,涵盖从基础操作到高级功能的各种技巧。我们将探讨如何生成文档、定义样式、提取表格数据以及处理超链接和图片等内容。 ... [详细]
  • 根据最新发布的《互联网人才趋势报告》,尽管大量IT从业者已转向Python开发,但随着人工智能和大数据领域的迅猛发展,仍存在巨大的人才缺口。本文将详细介绍如何使用Python编写一个简单的爬虫程序,并提供完整的代码示例。 ... [详细]
  • 本题通过将每个矩形视为一个节点,根据其相对位置构建拓扑图,并利用深度优先搜索(DFS)或状态压缩动态规划(DP)求解最小涂色次数。本文详细解析了该问题的建模思路与算法实现。 ... [详细]
  • 本文深入探讨了 Python 中的循环结构(包括 for 循环和 while 循环)、函数定义与调用,以及面向对象编程的基础概念。通过详细解释和代码示例,帮助读者更好地理解和应用这些核心编程元素。 ... [详细]
  • Python 异步编程:ASGI 服务器与框架详解
    自 Python 3.5 引入 async/await 语法以来,异步编程迅速崛起,吸引了大量开发者的关注。本文将深入探讨 ASGI(异步服务器网关接口)及其在现代 Python Web 开发中的应用,介绍主流的 ASGI 服务器和框架。 ... [详细]
  • Python第三方库安装的多种途径及注意事项
    本文详细介绍了Python第三方库的几种常见安装方法,包括使用pip命令、集成开发环境(如Anaconda)以及手动文件安装,并提供了每种方法的具体操作步骤和适用场景。 ... [详细]
  • 本文详细介绍了如何通过现代化工具快速、高效地安装Python第三方模块,帮助开发者简化安装流程并提高开发效率。 ... [详细]
  • Python包管理工具pip的使用指南
    本文详细介绍了如何使用pip进行Python包的安装、管理和常见问题的解决方法,特别针对国内用户提供了优化建议。 ... [详细]
  • Symfony是一个功能强大的PHP框架,以其依赖注入(DI)特性著称。许多流行的PHP框架如Drupal和Laravel的核心组件都基于Symfony构建。本文将详细介绍Symfony的安装方法及其基本使用。 ... [详细]
  • Python自动化测试入门:Selenium环境搭建
    本文详细介绍如何在Python环境中安装和配置Selenium,包括开发工具PyCharm的安装、Python环境的设置以及Selenium包的安装方法。此外,还提供了编写和运行第一个自动化测试脚本的步骤。 ... [详细]
  • 在Python 3环境中,当无法连接互联网时,可以通过下载离线模块包来实现模块的安装。具体步骤包括:首先从PyPI网站下载所需的模块包,然后将其传输到目标环境,并使用`pip install`命令进行本地安装。此方法不仅适用于单个模块,还支持依赖项的批量安装,确保开发环境的完整性和一致性。 ... [详细]
  • 提升Python多环境管理效率:深入探索多Python Pip应用策略
    提升Python多环境管理效率:深入探索多Python Pip应用策略 ... [详细]
  • Python,英国发音:ˈpaɪθən,美国发音:ˈpaɪθ��ːn,空耳读法为“ ... [详细]
  • Pyhotn3基础笔记(上卷)吉多范罗苏姆(GuidovanRossum)一.解释器Python的解释器如今有多个语言的实现,包括&#x ... [详细]
author-avatar
三砖先生
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有