PyCharm如何添加python库

1.使用pip命令在国内源下载需要的库

下面使用清华源,在cmd中输入如下命令就可以了

cpp 复制代码
pip install i https://pypi.tuna.tsinghua.edu.cn/simple 包名==版本号

2.如果出现报错信息,Cannot unpack file...这种情况,比如下面这种

cpp 复制代码
ERROR: Cannot unpack file C:\Users\wpp\AppData\Local\Temp\pip-unpack-rqlph24p\simple (downloaded from C:\Users\wpp\AppData\Local\Temp\pip-req-build-7a0cap2f, content-type: text/html; charset=utf-8); cannot detect archive format ERROR: Cannot determine archive format of C:\Users\wpp\AppData\Local\Temp\pip-req-build-7a0cap2f

3.那么可以使用如下cmd命令

cpp 复制代码
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn 包名

4.下载完毕后可以在cmd中输入

cpp 复制代码
pip list

来查看已经拥有的库

5.在cmd中使用

cpp 复制代码
where python

获得python的安装路径C:\Users\m\AppData\Local\Programs\Python\Python38-32\python.exe

6.在C:\Users\m\AppData\Local\Programs\Python\Python38-32\下找到 site-package文件夹,在里面找到你安装的库文件夹,有两个,全部复制

7.将其复制在Pycharm如下的文件夹下

之后就可以愉快使用啦

相关推荐
aqi005 小时前
15天学会AI应用开发(八)使用向量数据库实现RAG功能
人工智能·python·大模型·ai编程·ai应用
Csvn6 小时前
`functools.lru_cache` —— 一行代码搞定缓存加速
后端·python
金銀銅鐵1 天前
[Python] 从《千字文》中随机挑选汉字
后端·python
cup111 天前
[技术复盘] Windows Python 打包实战:Nuitka 环境踩坑总结与 CI 自动化构建全指南
python·ai·环境变量·ci·nuitka·skill
aqi001 天前
15天学会AI应用开发(七)有了大模型为什么还要引入RAG
人工智能·python·大模型·ai编程·ai应用
金銀銅鐵1 天前
用 Python 实现 Take-Away 游戏
python·游戏
copyer_xyf1 天前
Agent 流程编排
后端·python·agent
copyer_xyf1 天前
Agent RAG
后端·python·agent