如下图所示,使用pip时报错
File "D:\Microsoft Visual Studio\Shared\Anaconda3_64\Scripts\pip.exe", line 1
SyntaxError: Non-UTF-8 code starting with '\x90' in file D:\Microsoft Visual Stu
dio\Shared\Anaconda3_64\Scripts\pip.exe on line 1, but no encoding declared; see
http://python.org/dev/peps/pep-0263/ for details
在命令行中使用django-admin时也是相同的错误,但在pycharm中却可以正常创建django项目。
查了许久一直未找到原因,pip报错最后用重装pip的方式解决了,在命令行中输入easy_install pip,重装后恢复正常。
C:\Users\caiml>easy_install pip
Searching for pip
Best match: pip 19.0.3
Adding pip 19.0.3 to easy-install.pth file
Installing pip-script.py script to D:\Microsoft Visual Studio\Shared\Anaconda3_6
4\Scripts
Installing pip.exe script to D:\Microsoft Visual Studio\Shared\Anaconda3_64\Scri
pts
Installing pip3-script.py script to D:\Microsoft Visual Studio\Shared\Anaconda3_
64\Scripts
Installing pip3.exe script to D:\Microsoft Visual Studio\Shared\Anaconda3_64\Scr
ipts
Installing pip3.7-script.py script to D:\Microsoft Visual Studio\Shared\Anaconda
3_64\Scripts
Installing pip3.7.exe script to D:\Microsoft Visual Studio\Shared\Anaconda3_64\S
cripts
Using d:\microsoft visual studio\shared\anaconda3_64\lib\site-packages
Processing dependencies for pip
Finished processing dependencies for pip
命令行中输入easy_install django重装django,又报错系统缺少Microsoft Visual C++ Build Tools 2014,到http://go.microsoft.com/fwlink/?LinkId=691126下载Microsoft Visual C++ Build Tools 2015后默认安装后,再使用
easy_install django重装django后恢复正常。