简体   繁体   English

在命令行中使用python运行sqlite3

[英]Run sqlite3 with python in command line

I installed python3.3 and i am learning django 1.5x. 我安装了python3.3,我正在学习django 1.5x。 I chose sqlite3 to learn with django and i am running python, django - and trying to run - sqlite3 in command line at windows. 我选择了sqlite3来学习django,我正在运行python,django - 并尝试在Windows的命令行中运行--sqlite3。 All the problem is: where is the file of sqlite3 to run a command like > sqlite3 my_db ?? 所有的问题是:sqlite3的文件在哪里运行像> sqlite3 my_db这样的命令? I tried to found at C:\\Python33\\Lib\\sqlite3;C:\\Python33\\Lib and search at windows explorer but i really can't find. 我试图在C:\\Python33\\Lib\\sqlite3;C:\\Python33\\Lib并在Windows资源管理器中搜索,但我真的找不到。 I am running my projects at C:\\projects\\mysite 我在C:\\ projects \\ mysite上运行我的项目

Thanks in advance 提前致谢

Assuming that you want to inspect the database created by django, and assuming that the sqlite executable is installed, you can do the following to run sqlite in the command line: 假设您要检查由django创建的数据库,并假设已安装sqlite可执行文件,您可以执行以下命令在命令行中运行sqlite:

./manage.py dbshell

More information on this command can be found in the django documentation . 有关此命令的更多信息,请参阅django文档

Python itself dosen't contain a sqlite3 command. Python本身不包含sqlite3命令。

But the SQLite library includes a simple command-line utility named sqlite3 (or sqlite3.exe on windows) that allows the user to manually enter and execute SQL commands against an SQLite database. 但SQLite库包含一个名为sqlite3的简单命令行实用程序(或Windows上的sqlite3.exe),允许用户手动输入和执行SQLite数据库的SQL命令。 You can download it from here . 你可以从这里下载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM