Requirement already satisfied解决办法

原因分析:因为已经存在的numpy库是存在于其他的目录,如d:\programming\anaconda3\lib\site-packages (1.16.5)​​路径中,而我们的IDLE安装在​​d:\programming\Python37​​文件夹下,目前​​d:\programming\Python37\Lib\site-packages​​路径中是不存在numpy库的,所以运行python文件会报错。所以我们需要将numpy库安装在IDLE对应的路径下,才可以正常运行该python文件。

解决办法:

 在cmd中使用​​pip install --target=目标路径 工具包名字​​​格式的命令去安装所需要的库。例如,我使用​​pip install --target=d:/programming/Python37/Lib/site-packages numpy​​这个命令去安装numpy库,就可以成功安装。

如果使用第三方镜像,可以使用下面的命令:

pip install numpy --target=C:\Users\Lenovo\PycharmProjects\pythonProject\venv\Lib\site-packages -i https://pypi.tuna.tsinghua.edu.cn/simple/

pip install pandas --target=C:\Users\Lenovo\PycharmProjects\pythonProject\venv\Lib\site-packages -i https://pypi.tuna.tsinghua.edu.cn/simple/

注意:target参数后面要用你自己的的项目所在目录,如图所示:

 

posted @ 2023-10-12 14:51  YorkShare  阅读(2421)  评论(0编辑  收藏  举报