type
status
date
slug
summary
tags
category
icon
password

使用绿色版python

比较方便打包用于直接运行的程序,以及在新环境中使用

下载

  • 官网下载embed版本(Windows embeddable package (64-bit))

不使用pip,只用原来用到的库

  • 最好的做法是每个项目在开发的时候都有个单独的venv,与原有的环境隔离开来

  • 部署的时候直接用原来venv里面的Lib文件夹替换新环境的python embed中的Lib文件夹即可

安装pip

有网的情况下

  • 执行python get-pip.py

离线情况下

  • pypi下载pip,wheel,setuptools三个whl文件放到whl文件夹下,例如
    • wheel-0.37.1-py2.py3-none-any.whl
    • pip-22.0.4-py3-none-any.whl
    • setuptools-62.1.0-py3-none-any.whl
  • 执行python get-pip.py --no-index --find-links=whl

修改python37._pth

  • 根据注释,去掉import site前面的# (uncomment)

已有python环境,新增库及依赖

安装pipdeptree

pip install pipdeptree

导出依赖

  • 导出所有依赖pipdeptree -f > requirement.txt
  • 导出某个包的依赖(比如selenium)pipdeptree -p selenium -f> requirement.txt
notion image

下载依赖中的whl文件

pip download -d whl -r requirement.txt
whl为目标文件夹名

通过requirement.txt和whl文件夹安装依赖

pip install --no-index --find-links=d:\whl -r requirement.txt
hyperv 显卡虚拟化配置chrome dev 修改网页 JS
纸鸢
纸鸢
一个普通人🍚
统计
文章数:
6
公告
type
status
date
slug
summary
tags
category
icon
password
🎉NotionNext 4.0即将到来🎉
-- 感谢您的支持 ---
👏欢迎更新体验👏