Python
约 2 分钟阅读
标签:主题
- Which is the best book for learning python for absolute beginners on their own?Linkwww.quora.com/Which-is-the-best-book-for-learning-python-for-absolute-beginners-on-their-ownWhich is the best book for learning python for absolute beginners on their own? · Think Python · Dive Into Python · Learn Python the Hard Way笔记:Python
- Think PythonLinkgreenteapress.com/wp/think-pythonWhich is the best book for learning python for absolute beginners on their own? · Think Python · Dive Into Python · Learn Python the Hard Way笔记:Python
- Dive Into PythonLinkwww.diveintopython.netWhich is the best book for learning python for absolute beginners on their own? · Think Python · Dive Into Python · Learn Python the Hard Way笔记:Python
- Learn Python the Hard WayLinklearnpythonthehardway.org/bookWhich is the best book for learning python for absolute beginners on their own? · Think Python · Dive Into Python · Learn Python the Hard Way笔记:Python
- PyPy
- Highly performant implementation of Python 2 in Python
- Python in Python2 with JIT
- AnacondaGitHubconda/condaconda/conda · BSD-3, Python · Miniconda - 只有 conda 和 Python 的 Anaconda 最小发行版 · Anaconda 包含了非常多的基础包,开箱即用 · https://docs.anaconda.com/free/miniconda/笔记:conda
- Package, dependency and environment management for any language—Python, R, Ruby, Lua, Scala, Java, JavaScript, C/ C++, FORTRAN, and more.
- The Python Standard LibraryLinkdocs.python.org/3/libraryWhich is the best book for learning python for absolute beginners on their own? · Think Python · Dive Into Python · Learn Python the Hard Way笔记:Python
# venv
python3 -m venv .venv
# VIRTUAL_ENV_PROMPT 增加在 PS1 的内容
source .venv/bin/activate
# 确保安装 pip
python -m ensurepip
python3 -m venv <MYVENV>
python -m virtualenv
brew install pyenv
# poetry
python3 -m venv ~/.venvs/poetry
~/.venvs/poetry/bin/pip install poetry
alias poetry=~/.venvs/poetry/bin/poetry
mkdir useful
cd useful
python3 -m venv build/useful
source build/useful/bin/activate词汇
- setup.py
- 使用代码来描述发布(distribution)
- 区别于包,一个 distribution 可以包含 0 或多个包,但一般都是保持 1-1-1 关系:1 个发布,1 个包,1 个名字
- 一般以引入 setuptools 和 distutils 开始
__init__.py- py2 认为包含这文件的就是包/模块
__main__.py- 入口
- distutils
- 内建模块,不推荐使用,很久未维护
- setuptools
- 非内建模块,但一般虚拟环境都有
- 最小化代码
import setuptools
setuptools.setup(
name='my_special_package',
packages=setuptools.find_packages(),
)- tox
- 管理虚拟环境
- 主要用于测试和构建
- DevPI
- PyPI 兼容的本地开发服务
pip install devpi-server
devpi-server --start --init
# 指定用户、安装包
pip install devpi-client twine
devpi use http://localhost:3141
devpi user -c testuser password=123
devpi login testuser --password=123
devpi index -c dev bases=root/pypi
devpi use testuser/dev
twine upload --repository http://localhost:3141/testuser/dev \
-u testuser -p 123 my-package-18.6.0.tar.gz
pip install -i http://localhost:3141/testuser/dev my-packagePackagesdevpi-serverPyPI Packagedevpi-serverPyPIdevpi-clientPyPI Packagedevpi-clientPyPItwinePyPI PackagetwinePyPImy-packagePyPI Packagemy-packagePyPI
- pex
- Python 转可执行文件
- shiv
- 类似于 pex,但更简单,直接使用 pip
- xar - eXecutable ARchive
- 设计于打包自包含可的可执文件,以 py 为主
python setup.py bdist_xar --console-scripts=my-scriptentry_points=dict(
console_scripts=["my-script = package.module:function"],
)- pyproject.toml
- poetry
- flit
关联信息
反向链接、本文链接的其他页面和外部资料。
References
GitHub1 条
- conda/condagithub.com/conda/conda
其他外链6 条
- docs.python.org/3/librarydocs.python.org/3/library
- greenteapress.com/wp/think-pythongreenteapress.com/wp/think-python
- learnpythonthehardway.org/booklearnpythonthehardway.org/book
- pypy.orgpypy.org/
- www.diveintopython.netwww.diveintopython.net/
- www.quora.com/Which-is-the-best-book-for-learning-python-for-absolute-beginners-on-their-ownwww.quora.com/Which-is-the-best-book-for-learning-python-for-absolute-beginners-on-their-own