【PyCharm】三方库安装后,import提示找不到对应模块

安装pycharm后,import numpy,运行后提示 ModuleNotFoundError:No module named'XXX'

打开命令行,输入pip install numpy后,成功安装,但再次运行仍然提示错误。

原因猜测是第三方库的安装路径与import路径不一致导致

解决方法:

1.打开软件,通过路径【File】→【Settings】→【Project】→【Project Interpreter】来到我们配置Python环境的界面。一般情况下,这里是一片空白。

2.点击小齿轮,在弹出的选项中点击【Show All】,然后再弹出的窗口中点击【+】号,进入配置页面。

3.这里可以选择【New Environment】或【Existing Environment】,建议选择【Existing Environment】,然后根据自己安装Python的路径,找到Python.exe,然后勾选【make avaliable to all projects】,将该Python环境应用到所有的项目,最后点击【OK】。

4.这个时候我们会来到这个页面,这里是我们当前配置的Python环境中包含的库信息,点击【OK】,即可完成我们的Python环境配置。

完成后即可正常运行。

如果还是不行,则点击上图 “+” ,在弹出框中搜索numpy,安装即可。

为什么在pycharm下载安装插件会失败?:PS D:\NEW desktop\app_house> pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple pyhive django-adminlte-ui==1.7.2 beautifulsoup4==4.12.2 fake_useragent==1.4.0 certifi==2020.12.5 chardet==4.0.0 django==3.1.7 djangorestframework==3.12 et-xmlfile==1.0.1 idna==2.10 jdcal==1.4.1 openpyxl==3.0.6 pytz==2021.1 requests==2.25.1 django-simpleui==2023.3.1 urllib3==1.26.3 xlwt lxml numpy beautifulsoup4 selenium==3.12.0 pandas pyecharts snownlp geopy wordcloud scikit-learn jieba faker django-import-export==2.7.1 WARNING: Ignoring invalid distribution -ip (d:\anaconda\lib\site-packages) Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting pyhive ERROR: HTTP error 403 while getting https://pypi.tuna.tsinghua.edu.cn/packages/f6/ec/5c658b3a4d99a6d91450 30cc8e003c3f7efc668d866e88544812ab0af310/PyHive-0.7.0.tar.gz (from https://pypi.tuna.tsinghua.edu.cn/simple/pyhive/) [notice] A new release of pip is available: 24.3.1 -> 25.0.1 [notice] To update, run: python.exe -m pip install --upgrade pip ERROR: Could not install requirement pyhive from https://pypi.tuna.tsinghua.edu.cn/packages/f6/ec/5c658b3a4 d99a6d9145030cc8e003c3f7efc668d866e88544812ab0af310/PyHive-0.7.0.tar.gz because of HTTP error 403 Client Er ror: Forbidden for url: https://pypi.tuna.tsinghua.edu.cn/packages/f6/ec/5c658b3a4d99a6d9145030cc8e003c3f7e fc668d866e88544812ab0af310/PyHive-0.7.0.tar.gz for URL https://pypi.tuna.tsinghua.edu.cn/packages/f6/ec/5c6 58b3a4d99a6d9145030cc8e003c3f7efc668d866e88544812ab0af310/PyHive-0.7.0.tar.gz (from https://pypi.tuna.tsinghua.edu.cn/simple/pyhive/) PS D:\NEW desktop\app_house>
03-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值