Myluzh Blog

Strive to become a dream architect.

python环境迁移_python依赖包整体迁移方法

2022-8-11 myluzh Python

1.新建site-packages目录,进入到site-packages目录下; 2.在site-packages目录下执行pip freeze >requirements.txt; 3.查看requirements.txt,可以看到当前机器的python所有依赖包已生成列表 4.在当前目录下执行pip download -rrequirements.txt,可以看到pip开始下载依赖包列表中的所有依赖包 5.等待下载完成后,可以看到当前目录下已经有了依赖包文件 6.将site-packages文件夹打包,移动至我们需要这些依赖包的机器上; 7.在当前机器的site-packages目录下执行:pip install --no-index --find-links=/xxx/xxx/site-packages -r /xxx/xxx/site-packages/requirements.txt (其中:/xxx/xxx/site-packages是指定依赖包路径,/xxx/xxx/site-packages/requirements.txt是指定依赖包列表路径); 8.执...

阅读全文>>

标签: python pip

评论(0) (917)

python更换国内的pip源

2020-4-8 myluzh Python

0x01 国内pip源地址 阿里云 http://mirrors.aliyun.com/pypi/simple/ 豆瓣 http://pypi.douban.com/simple/ 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 0x02 临时使用pip源 在使用pip时候,后面加上参数-i 镜像地址,例如: pip3 install pygame -i http://mirrors.aliyun.com/pypi/simple/ 0x03 永久更换pip源 1.Linux下,修改 ~/.pip/pip.conf 没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹。内容如下: [global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple [install] trusted-host = https://pypi.tuna.tsinghua.edu.cn 2.window...

阅读全文>>

标签: python pip

评论(0) (654)