修改pip的版本
安装各种库时,会有各种报错。
如下报错:
AttributeError: ‘NoneType’ object has no attribute ‘bytes’
Non-zero exit code(2)
list index out of range
DistutilsPlatformError: Microsoft Visual C++ 14.0 is required.
try to run this command from the system terminal .Make sure that you use the correct version of 'pip'
都可以通过升级或降低pip的版本来解决。
在pycharm底部的terminal终端上执行如下任一条命令
升级pip到指定版本 python -m pip install pip==20.2.4
升级pip到最新版本 python -m pip install --upgrade pip
强制更新pip python -m pip install -U --force-reinstall pip
设置镜像源:
1.直接在pycharm的管理仓库设置

2.设置pip.ini文件来设置镜像源
1).先查看一下自己的pip版本,输入:pip list ;

2)在我的电脑地址栏当中输入 %APPDATA% ,进入到文件夹;

3)进入以后新建一个文件夹,接着再创建一个 pip.ini 文件,如果创建文本看不到后缀名,可点击我的电脑最上面的查看按钮,选择查看文件扩展名;

4)然后在 pip.ini 文件中放入如下四行代码:
1 [global]
2 index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
3 [install]
4 trusted-host= pypi.tuna.tsinghua.edu.cn
3.直接在命令行中带上镜像源
python.exe -m pip install keras -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
python.exe -m pip install --index-url https://pypi.tuna.tsinghua.edu.cn/simple/ pip==19.3
pip install -i https://pypi.douban.com/simple/ pandas