会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132553个问题
Python 全系列/第一阶段:Python入门/编程基本概念 23611楼
Python 全系列/第十五阶段:Python 爬虫开发/移动端爬虫开发- 23612楼
JAVA 全系列/第三阶段:数据库编程/MySQL数据库的使用 23613楼
WEB前端全系列/第一阶段:HTML5+CSS3模块/初识CSS 23615楼
Python 全系列/第一阶段:Python入门/序列 23617楼

C:\Windows\system32>workon django_env

(django_env) C:\Windows\System32>pip install mysqlclient

Collecting mysqlclient

  Using cached mysqlclient-1.4.6.tar.gz (85 kB)

Building wheels for collected packages: mysqlclient

  Building wheel for mysqlclient (setup.py) ... error

  ERROR: Command errored out with exit status 1:

   command: 'D:\python_env\django_env\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Jace\\AppData\\Local\\Temp\\pip-install-v7ymmrjl\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\Jace\\AppData\\Local\\Temp\\pip-install-v7ymmrjl\\mysqlclient\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Jace\AppData\Local\Temp\pip-wheel-qh9stb47'

       cwd: C:\Users\Jace\AppData\Local\Temp\pip-install-v7ymmrjl\mysqlclient\

  Complete output (30 lines):

  running bdist_wheel

  running build

  running build_py

  creating build

  creating build\lib.win32-3.8

  creating build\lib.win32-3.8\MySQLdb

  copying MySQLdb\__init__.py -> build\lib.win32-3.8\MySQLdb

  copying MySQLdb\_exceptions.py -> build\lib.win32-3.8\MySQLdb

  copying MySQLdb\compat.py -> build\lib.win32-3.8\MySQLdb

  copying MySQLdb\connections.py -> build\lib.win32-3.8\MySQLdb

  copying MySQLdb\converters.py -> build\lib.win32-3.8\MySQLdb

  copying MySQLdb\cursors.py -> build\lib.win32-3.8\MySQLdb

  copying MySQLdb\release.py -> build\lib.win32-3.8\MySQLdb

  copying MySQLdb\times.py -> build\lib.win32-3.8\MySQLdb

  creating build\lib.win32-3.8\MySQLdb\constants

  copying MySQLdb\constants\__init__.py -> build\lib.win32-3.8\MySQLdb\constants

  copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.8\MySQLdb\constants

  copying MySQLdb\constants\CR.py -> build\lib.win32-3.8\MySQLdb\constants

  copying MySQLdb\constants\ER.py -> build\lib.win32-3.8\MySQLdb\constants

  copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.8\MySQLdb\constants

  copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.8\MySQLdb\constants

  running build_ext

  building 'MySQLdb._mysql' extension

  creating build\temp.win32-3.8

  creating build\temp.win32-3.8\Release

  creating build\temp.win32-3.8\Release\MySQLdb

  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -ID:\python_env\django_env\include -Id:\python3.8.2\include -Id:\python3.8.2\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.8\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS

  _mysql.c

  MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory

  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

  ----------------------------------------

  ERROR: Failed building wheel for mysqlclient

  Running setup.py clean for mysqlclient

Failed to build mysqlclient

Installing collected packages: mysqlclient

    Running setup.py install for mysqlclient ... error

    ERROR: Command errored out with exit status 1:

     command: 'D:\python_env\django_env\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Jace\\AppData\\Local\\Temp\\pip-install-v7ymmrjl\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\Jace\\AppData\\Local\\Temp\\pip-install-v7ymmrjl\\mysqlclient\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Jace\AppData\Local\Temp\pip-record-c_7pdi53\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\python_env\django_env\include\site\python3.8\mysqlclient'

         cwd: C:\Users\Jace\AppData\Local\Temp\pip-install-v7ymmrjl\mysqlclient\

    Complete output (30 lines):

    running install

    running build

    running build_py

    creating build

    creating build\lib.win32-3.8

    creating build\lib.win32-3.8\MySQLdb

    copying MySQLdb\__init__.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\_exceptions.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\compat.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\connections.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\converters.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\cursors.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\release.py -> build\lib.win32-3.8\MySQLdb

    copying MySQLdb\times.py -> build\lib.win32-3.8\MySQLdb

    creating build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\__init__.py -> build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\CR.py -> build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\ER.py -> build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.8\MySQLdb\constants

    copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.8\MySQLdb\constants

    running build_ext

    building 'MySQLdb._mysql' extension

    creating build\temp.win32-3.8

    creating build\temp.win32-3.8\Release

    creating build\temp.win32-3.8\Release\MySQLdb

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Dversion_info=(1,4,6,'final',0) -D__version__=1.4.6 "-IC:\Program Files (x86)\MySQL\MySQL Connector C 6.1\include\mariadb" -ID:\python_env\django_env\include -Id:\python3.8.2\include -Id:\python3.8.2\include "-IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.10240.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\8.1\include\shared" "-IC:\Program Files (x86)\Windows Kits\8.1\include\um" "-IC:\Program Files (x86)\Windows Kits\8.1\include\winrt" /TcMySQLdb/_mysql.c /Fobuild\temp.win32-3.8\Release\MySQLdb/_mysql.obj /Zl /D_CRT_SECURE_NO_WARNINGS

    _mysql.c

    MySQLdb/_mysql.c(29): fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory

    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2

    ----------------------------------------

ERROR: Command errored out with exit status 1: 'D:\python_env\django_env\Scripts\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Jace\\AppData\\Local\\Temp\\pip-install-v7ymmrjl\\mysqlclient\\setup.py'"'"'; __file__='"'"'C:\\Users\\Jace\\AppData\\Local\\Temp\\pip-install-v7ymmrjl\\mysqlclient\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Jace\AppData\Local\Temp\pip-record-c_7pdi53\install-record.txt' --single-version-externally-managed --compile --install-headers 'D:\python_env\django_env\include\site\python3.8\mysqlclient' Check the logs for full command output.




安装mysqlclient报错

Python 全系列/第十二阶段:Python_Django3框架/Django初级 23618楼

import random
from tkinter import *
from tkinter import messagebox
class Application(Frame):
    def __init__(self,master=None):
        super().__init__(master)
        self.master=master
        self.pack()
        self.createWidget()

    def createWidget(self):
        self.canvas=Canvas(self,width=300,height=400,bg="green") #创建组件
        self.canvas.pack()
        self.canvas.create_line(30,30,500,500) #画直线
        self.canvas.create_rectangle(20,50,80,40)
        global photo
        photo=PhotoImage(file=r"C:\Users\86137\Documents\mindplus-py\environment\Python3.6.5-64\tcl\tk8.6\images\logo64.gif")
        self.canvas.create_image(200,50,image=photo)

        Button(self,text="随机生成十个矩形",command=self.confirm).pack(side="left")

    def confirm(self):
        for x in range(0,10):
            x1 = random.randrange(int(self.canvas["width"]/2))
            y1 = random.randrange(int(self.canvas["height"] / 2))
            x2 = x1+random.randrange(int(self.canvas["width"] / 2))
            y2 = y1+random.randrange(int(self.canvas["height"] / 2))
            self.canvas.create_rectangle(x1,y1,x2,y2)


root=Tk()
root.geometry("500x600+300+300")
app=Application(master=root)
root.mainloop()

老师我这个为什么会报错?

Exception in Tkinter callback

Traceback (most recent call last):

  File "D:\python\lib\tkinter\__init__.py", line 1892, in __call__

    return self.func(*args)

  File "D:\python_exec\py02\GUI图形编程\canvas布图.py", line 24, in confirm

    x1 = random.randrange(int(self.canvas["width"]/2))

TypeError: unsupported operand type(s) for /: 'str' and 'int'


Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 23619楼
JAVA 全系列/第一阶段:JAVA 快速入门/IDEA的使用和第一个java项目 23620楼
Python 全系列/第一阶段:Python入门/编程基本概念 23621楼
JAVA 全系列/第一阶段:JAVA 快速入门/控制语句、方法、递归算法 23622楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 23624楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637