Sqlite3 command not recognized in command prompt (Python2.7) - python-2.7

im fairly new to sqlite. I ran the 'sqlite3' command in command prompt and the command was not recognized.
I cant find the sqlite3.exe in my python27 installation (so i cant add it to paths)
I also tried adding a path to the sqlite dll which did not work (Windows Command prompt shell for sqlite3).
How can i get this command to work?

The complete solution is to install the 'sqlite-tools' and the 'sqlite-dlls' from the precompiled windows binaries at this link:
http://sqlite.org/download.html

Related

How to build PythonQt in ubutnu

I want to embed the python script in my c++ Qt application, By searching on the net I found that PythonQt is exactly what I am looking for but when I went to it's github repo there is build description given for windows system but not for ubuntu system so after cloning the repo if I include it's src in my Qt .pro file it gives me output that
Python.h not found, I think the reason is that I didn't build it in my system. Is there anyone who could tell me that how to build PythonQt in ubuntu. The link for their repo is this: https://github.com/MeVisLab/pythonqt
If this didn't work you can also suggest me some other thing which will help me to embed python scripts into my Qt c++ application.
First clone the repo by using the following command
https://github.com/MeVisLab/pythonqt.git
After that cd into the clone folder and execute the below command to build it into your system.
qmake
This command will generate the MakeFile into your current directory run the following command to completely build the PythonQt in your system.
sudo make all
sudo make install
While executing those commands if you get the following error
fatal error: 'private/qmetaobjectbuilder_p.h'
Run the below command to solve this
sudo apt install qtbase5-private-dev

Problem importing torch in command prompt, but it works directly in VS code / Jupyter

I am trying to run a flask app in my command prompt on Windows 10. Whenever I try to run it, it errors out when trying to import torch. I have created a fresh environment and installed the latest pytorch from this page https://pytorch.org/get-started/locally/ but it still doesn't work in command prompt. Oddly, if I just execute code that says "import torch" in jupyter notebook or VS code, it doesn't error out. It only gives me the error in Command Prompt.
Does anyone know what the issue could be?
Short answer: If possible, use Anaconda Prompt. It's accessible from the Start Menu > Anaconda > Anaconda Prompt.
Long answer: The problem is due to the order of the different Python installations in the PATH variable, as you can see with echo %PATH%. System Python comes first, which can be seen with which python.
The recommendation is to use Anaconda Prompt, since it properly sets up the PATH variable with all required Anaconda paths. More importantly, it avoids interfering with other software in regular command prompt. So, your command prompt won't have any unintended consequences from using Anaconda.
If there is a reason that requires you to use regular command prompt, you can change the order with set PATH=C:\Anaconda\;%PATH% (temporary for this command prompt) or setx PATH=C:\Anaconda\;%PATH% (permanent). There are other libs that may be required to be included as well, which you can check by printing the PATH variable at the Anaconda Prompt.
Another option (Win10): Start Menu > type 'environment' > click 'Edit the system environment variables'. Click Advanced > Environment Variables... Double click Path and change the order between system Python and Anaconda Python.

Installing Python 2.7 on Windows 8

So I'm trying python 2.7 on my Windows. It is running Windows 8. I cannot add it to my path. I've done the usual: using the advanced system settings, environment variables, adding C:\Python27 in system variables.
However, when I type Python in command prompt it says 'python is not recognized ..'
I think that the essence of this question is how to install Python and be able to use it from the command line. The steps below show how to get all that working. Check that you didn't miss anything:
From https://www.python.org/download/releases/2.7.6 download appropriate Python 2.7.6 Windows Installer. (If that link doesn't work, check https://www.python.org/downloads/)
Run the file
Select install for all users or install just for me, click Next
You'll see it installs under the C:\Python27 folder, click Next
Click Next again for the 'Customize Python' step
Click Finish
Open Control Panel, then System
Click 'Advanced system settings' on the left
Click the 'Environment Variables' button
Under 'System variables' click the variable called 'Path' then the 'Edit...' button. (This will set it for all users, you could instead choose to edit the User variables to just set python as a command prompt command for the current user)
Without deleting any other text, add C:\Python27; (include the semi-colon) to the beginning of the 'Variable value' and click OK.
Click OK on the 'Environment Variables' window.
Open a new command prompt window type python, you will have python running in the command prompt. Note: command prompt windows open prior to setting the Environment Variable will not have the python command available.
Easiest way is to open CMD or powershell as administrator and type
set PATH=%PATH%;C:\Python27
System variables usually require a restart to become effective. Does it still not work after a restart?
Make sure you don't put a space between the semi-colon and the new folder location that you are adding to the path.
For example it should look like...
{last path entry};C:\Python27;C:\Python27\Scripts;
...not...
{last path entry}; C:\Python27; C:\Python27\Scripts;
How to install Python / Pip on Windows Steps
Visit the official Python download page and grab the Windows installer for the latest version of Python 3.
python.org/downloads/
Run the installer. Be sure to check the option to add Python to your PATH while installing.
Open PowerShell as admin by right clicking on the PowerShell icon and selecting ‘Run as Admin’
To solve permission issues, run the following command:
Set-ExecutionPolicy Unrestricted
Next, set the system’s PATH variable to include directories that include Python components and packages we’ll add later. To do this:
C:\Python35-32;C:\Python35-32\Lib\site-packages\;C:\Python35-32\Scripts\
download the bootstrap scripts for easy_install and pip from https://bootstrap.pypa.io/
ez_setup.py
get-pip.py
Save both the files in Python Installed folder
Go to Python folder and run following:
Python ez_setup.py
Python get-pip.py
To create a Virtual Environment, use the following commands:
cd c:\python
pip install virtualenv
virtualenv test
.\test\Scripts\activate.ps1
pip install IPython
ipython3
Now You can install any Python package with pip
That’s it !!
happy coding
Visit This link for Easy steps of Installation python and pip in windows http://rajendralora.com/?p=183
Type this in Windows PowerShell or CMD:
"[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27", "User")"
After running the command, please restart PowerShell or CMD. If it still doesn't work, restart your PC.
there is a simple procedure to do it go to controlpanel->system and security ->system->advanced system settings->advanced->environment variables
then add new path enter this in your variable path and values
i'm using python 2.7 in win 8 too but no problem with that. maybe you need to reastart your computer like wclear said, or you can run python command line program that included in python installation folder, i think below IDLE program. hope it help.
GUI Option:
Open System Properties
a. Type it in the Start Menu
b. Use the keyboard shortcut Win+Pause)
c. From Windows Explorer address bar go to
%windir%\System32\SystemPropertiesProtection.exe
d. Write SystemPropertiesProtection in run window and press Enter
Switch to the Advanced tab
Click Environment Variables
Select PATH in the System variables section
Click Edit
Add python's path to the end of the list (the paths are separated by semicolons).
For example:
C:\Windows;C:\Windows\System32;C:\Python27
Command Line Option:
Run Command Prompt as administrator
Check existing paths under PATH variable (the paths are separated by semicolons). If your python folder already listed then no need to add again. Default python folder is C:\Python27
C:\Windows\system32>path or C:\Windows\system32>echo %PATH%
Append python path using setx command. The /M option sets the variable at SYSTEM scope.
The default behavior is to set it for the USER.
C:\Windows\system32>setx /M PATH "%PATH%;C:\Python27"

Installing c++ boost using cygwin: can't find configure file

I'm trying to install Boost for c++. Since I use cygwin (on Windows 7) I follow these instructions for Unix.
I start by downloading boost_1_55_0.zip from sourceforge. The instructions tell me to run tar --bzip2 -xf /path/to/boost_1_55_0.zip but this doesn't work (probably because the downloaded file is .zip and not .tar.bz2; I can't find the latter anywhere to download), so instead I use winrar and unzip it into /usr/local.
After this the header-only libraries work fine, but I need the ones where a build is necessary.
The instructions tells me to go to the boost folder and run./configure --help, but this doesn't work; I get the message -bash: ./configure: No such file or directory. So I locate the file configure in the folder /usr/local/boost_1_55_0/tools/build/v2/engine/boehm_gc, go there and try again, and this time it works: I get the help for configure.
I then try to run ./configure --prefix=/usr/local/boost_1_55_0 --enable-cplusplus but get the error message configure: error: cannot run /bin/sh ./config.sub. I try it with only one or none of the options too but that doesn't help.
Any ideas?
I don't know what guide you're following, but to install boost I have done:
cd boost
./bootstrap.sh
./b2
./b2 install
stop
As report boost doc:
If you plan to build from the Cygwin bash shell, you're actually
running on a POSIX platform and should follow the instructions for
getting started on Unix variants. Other command shells, such as
MinGW's MSYS, are not supported—they may or may not work.

Error while accessing sqlite3 shell from django application

When I run python manage.py dbshell command I get this error:
Error: You appear not to have the 'sqlite3' program installed or on your path. The solution is partly hinted at in the second post of this thread. But how it can be solved on ubuntu? The python I'm using is version 2.6.
Installing the sqlite program should solve the problem:
sudo apt-get install sqlite3
(or use synaptic if you prefer a GUI interface)
To download SQLite, you open the download page of the SQlite website.
First, go to the https://www.sqlite.org website.
Second, open the download page https://www.sqlite.org/download.html
SQLite provides various versions for various platforms e.g., Windows, Linux, Mac, etc. You should choose an appropriate version to download.
For example, to work with SQLite on Windows, you download the command-line shell program as shown in the screenshot below.
The downloaded file is ZIP format and its size is quite small.
Install SQLite
Installing SQLite is simple and straightforward.
First, create a new folder e.g., C:\sqlite.
Second, extract the content of the file that you downloaded in the previous section to the C:\sqlite folder. You should see the sqlite3.exe is in the C:\sqlite folder.
To verify the installation, you perform the following steps:
First, open the command line window and navigate to the C:\sqlite folder.
Second, enter sqlite3, you should see the following window
Third, you can type the .help command from the sqlite> prompt to see all available commands in sqlite3.
Fourth, to quit the sqlite>, you use .quit command as follows:
Append the directory where you installed the sqlite to the system path variable in windows environment variables and kaboom. Mine worked just fine.
Happy programming...!