Python第三方库


第三方库的都安装在 \Lib\site-packages

第三方库的安装方式

pip命令安装

pip install xlwings

源码安装

下载库文件压缩包,并解压。在cmd命令窗口进入解压好的文件夹,通常会看见一个 setup.py 的文件,执行安装命令:

 python setup.py install

第三方库的复制移动

在没有网络的情况下非常适合从一个已经安装包的电脑上拷贝包到另一个没有安装包的电脑上。
1、进入第三方库安装的路径的文件夹。\site-packages
2、找到需要的包复制即可。注意一个库的包有两个文件,要同时复制。

第三方库的批量安装

1.导出安装库以及版本

pip freeze > requirements.txt

2.批量安装

pip install -r ./requirements.txt

镜像源

临时安装 

pip install 安装包名称 -i https://pypi.tuna.tsinghua.edu.cn/simple

整体配置

# 首先,看一下目前conda源都有哪些内容
conda info
# 然后,删除并恢复默认的conda源
conda config --remove-key channels

# 添加指定源
conda config --add channels *(*指代你要添加的源)
# 设置安装包时,显示镜像来源,建议显示
conda config --set show_channel_urls yes 
# 删除指定源
conda config --remove channels *(*代表你要删除的源)

镜像源地址

清华镜像源 :https://mirrors.tuna.tsinghua.edu.cn/
中科大镜像源:https://mirrors.ustc.edu.cn/
其他源参见:https://developer.aliyun.com/article/439152

参考:

https://blog.csdn.net/m0_38039437/article/details/101779197

https://blog.csdn.net/weixin_47046791/article/details/124279716

https://blog.csdn.net/adreammaker/article/details/123396951