为什么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>
时间: 2025-03-15 08:17:36 浏览: 60
### 解决方案
当使用 `pip` 命令从清华大学或其他国内镜像源安装 Python 包时,如果遇到 HTTP 403 错误,通常是因为网络请求被拒绝或者配置不正确。以下是针对此问题的分析和解决方案:
#### 配置正确的镜像源地址
确保使用的镜像源 URL 是有效的。根据引用中的描述[^1],可以尝试以下命令来安装 `pyhive` 包并指定清华大学的镜像源:
```bash
pip install pyhive -i https://pypi.tuna.tsinghua.edu.cn/simple
```
此外,也可以选择阿里云的镜像源作为替代选项[^2]:
```bash
pip install pyhive -i https://mirrors.aliyun.com/pypi/simple
```
#### 更新 pip 工具版本
有时较低版本的 `pip` 可能无法正常解析某些镜像源或存在兼容性问题。因此,在执行安装之前,请先升级到最新版 `pip`[^3]:
```bash
python -m pip install --upgrade pip
```
完成上述操作后再重新运行带有镜像参数的安装指令。
#### 设置全局镜像源(可选)
为了避免每次都需要手动输入 `-i` 参数,可以通过修改 `pip.conf` 文件的方式设定默认使用的镜像站点[^4]。对于 Linux/Mac 用户来说,默认路径位于 `~/.config/pip/pip.conf`;而对于 Windows 则是在 `%APPDATA%\pip\pip.ini` 中定义如下内容:
```ini
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
```
之后无需再额外指明镜像链接即可直接调用 `pip install pyhive` 进行部署。
---
### 注意事项
尽管更换镜像源能够有效缓解速度缓慢的问题,但如果仍然遭遇权限受限 (即所谓的 'Forbidden' 或者状态码 403),则可能是目标资源本身暂时不可获取或者是账户访问限制所致。此时建议等待一段时间再次尝试或是切换至其他可用镜像服务提供商测试效果。
---
阅读全文
相关推荐


















