Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.6k views
in Technique[技术] by (71.8m points)

python - Why is sqlite3 not being recognized by VSCode?

I am having trouble running sqlite3 in the powershell in VSCode. I already have sqlite3 in my PATH so that is not it. My code is below and seems to be working just fine and it is properly creating the students.db file. However when I go to access it in the terminal I get this.

PS C:UsersDevinDesktopIntermediate Python> sqlite3 students.db

sqlite3 : The term 'sqlite3' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • sqlite3 students.db
    • CategoryInfo : ObjectNotFound: (sqlite3:String) [], CommandNotFoundE xception
    • FullyQualifiedErrorId : CommandNotFoundException
from peewee import *

db = SqliteDatabase('students.db')


class Student(Model):
    username  = CharField(max_length=255, unique=True)
    points = IntegerField(default=0)
    

    class Meta:
        database = db


if __name__ == '__main__':
    db.connect()
    db.create_tables([Student], safe=True)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First make sure the path using: $env:psmodulePath. Then use Import-Module to import


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...