11.0.常见问题
一、PIP安装包时报错:error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”
解决方式一:按照提示去官网下载Visual Studio
https://visualstudio.microsoft.com/zh-hans/downloads/
解决方法二:安装Microsoft visual c++ 14.0
如果不想安装完整的visual studio,可以选择只安装build tools,在命令行下进行编译等操作。这样可以节省硬盘空间,实测占用7GB。
下载visualcppbuildtools_full.exe,下载地址Microsoft Visual C++ Build Tools 2015
双击visualcppbuildtools_full.exe,安装类型选择默认值,等待20分钟左右即可完成安装。(若出现安装包丢失或损坏,是由于网络问题引起,请挂vpn后重试)
安装完成后,再通过pip安装自己所需的包即可。
解决方法三:手动下载安装WHL文件
通过lfd.uci.edu下载对应Python版本(cp36 对应 python3.6版本)、操作系统(电脑win32或win64位)的.whl文件
下载完成后,再执行pip install *.whl
二、安装mysql-python时出现error: command’C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe’ failed with exit status 2
python3.*和python2.*两个的版本不一样,所以安装的东西也不一样:
MySQLdb 安装mysql的连接包。
工具安装 Python3.x版本:Pip install mysqlclient
但是Python2.x 版本:pip install mysql-python。
三、Unable to create the django_migrations table ((1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6) NOT NULL)' at line 1"))
原因
Django2.1不再支持MySQL5.5,必须5.6版本以上
解决方法
django降级 pip install Django==2.0.0 -i https://pypi.douban.com/simple
或者 mysql升级
四、makemigrations polls报错:No module named 'polls.apps.PollsConfigdjango'; 'polls.apps' is not a package
查看app目录下,apps.py文件和migrations目录都存在
检查settings.py中INSTALLED_APPS配置,发现新增配置后面忘记写逗号导致,添加逗号后执行正常。
正确配置如下:
五、Centos7下psutil安装报错:error: command ‘gcc’ failed with exit status 1
解决方法
1、安装运行库:
2、若python3是使用yum安装的,则安装python3的devel环境
六、Centos7中执行 pip3 install mysqlclient报错OSError: mysql_config not found
解决方法
安装运行库
安装后,再pip3 install mysqlclient 即可
七、安装python-ldap fatal error: lber.h: No such file or directory
解决方法
Last updated
Was this helpful?