Python FAQ
约 1 分钟阅读
标签:FAQ
- PEP 8 Spaces are the preferred indentation method.
- 官方推荐 4 space
- distutils
- 3.12 之后移除
- Python 3.12 需要 numpy > 1.26.4
- paddlex 3.0.0b2 依赖 numpy 1.24.4
__pycache__- 缓存目录
- 默认开启
- 可以通过
python -B关闭 - 存储的文件名是
__pycache__/module_name.cpython-312.pyc
python -V && pip -V
pip list --outdated
# 简单的 HTTP 服务器
python3 -m http.server 8080- PYTHONHOME
- PYTHONPATH
- docs.python.org/3/using/cmdline.html
ImportError: attempted relative import with no known parent package
一般是因为直接运行了一个模块文件,而不是通过包的方式运行。
不能
from .module_name
# 修改为
from module_nameModuleNotFoundError: No module named 'PIL'
pip install pillowdecord
error: Distribution `decord==0.6.0 @ registry+https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple` can't be installed because it doesn't have a source distribution or wheel for the current platform
hint: You're on Linux (`linux_x86_64`), but `decord` (v0.6.0) only has wheels for the following platforms: `manylinux2010_x86_64`, `win_amd64`; consider adding your platform to `tool.uv.required-environments` to ensure uv resolves to a version with compatible wheels
error building image: error building stage: failed to execute command: waiting for process to exit: exit status 2- dmlc/decordGitHubdmlc/decord
- georgia-tech-db/eva-decordGitHubgeorgia-tech-db/eva-decord
- fork decord
关联信息
反向链接、本文链接的其他页面和外部资料。
参考资料
GitHub2 条
- dmlc/decordgithub.com/dmlc/decord
- georgia-tech-db/eva-decordgithub.com/georgia-tech-db/eva-decord
其他外链1 条
- docs.python.org/3/using/cmdline.htmldocs.python.org/3/using/cmdline.html