Unable to the "import turtle" in python3.5.2 - python

The error I get is:
No module named '_tkinter'
I have tried using:
sudo apt-get install python python-tk idle python-pmw python-imaging
The turtle works in python2.7.1

You probably only installed the turtle for python 2.7.
sudo apt-get install python3-tk
(and others you may need)

Related

infomap is an un-recognized package in my laptop

I have installed infomap on my Ubuntu using:
sudo apt-get install build-essential
But when I want to use it in python program just like:
from infomap import infomap
I get this error:
No module named infomap
do I have to import any packages before it? what is wrong?
infomap is a python pip software package. You need to install it via pip, which is a python package manager. Try pip install infomap. If it gives you an error about pip not being found, you need to install it with something like sudo apt-get install python-pip, but I think it's a part of the build-essential package you already installed.

How to install PyAutoGUI

I am running OS X El Capitan v. 10.11.3
I am trying to install PyAutoGUI
On Terminal, I did the following successfully:
sudo pip3 install pyobjc-core
sudo pip3 install pyobjc
When I tried running "sudo pip3 install pyautogui" I got the following error in Terminal:
Command "python setup.py egg_info" failed with error code 1 in
/private/tmp/pip-build-skuvquyu/pyscreeze
I am not sure what to do about this so if anyone has any advice, I would appreciate it.
Thanks
Found an answer to the problem
On Linux, this is:
sudo pip3 install python3-xlib
sudo apt-get install scrot
sudo apt-get install python3-tk
sudo apt-get install python3-dev
sudo pip3 install pyautogui
ta daaaa :D
It seems like there's a problem with pip. Try reinstalling it.
It'd be much better if you installed pyautogui directly from github.
Step 1:
git clone https://github.com/asweigart/pyautogui
Step 2:
cd pyautogui
Step 3:
sudo python3 setup.py install
If python3 doesn't work, try python.
Now im using Ubuntu 14.04, but I would try installing the problematic module pyscreeze with:
sudo pip3 install pyscreeze
I personally got another error about missing module called PIL
sudo pip3 install pillow
And then i got some error message about jpeg ValueError: jpeg is required unless explicitly disabled using --disable-jpeg, aborting
I hope you'll have more luck.
This installation error has most likely been fixed as of version 0.9.34. The module tried to load the PIL/Pillow module during installation.
i have installed pyautogui on my windows :
I went to my python directory
There shift + right mouse click and open the command prompt
Type "python -m pip install pyautogui" (without quotes)

Can't install zbar

I am trying to use the qrtools module with Python 3.4.2 on my Raspberry Pi 2, however it cannot run as I don't have the zbar module installed.
Trying
pip-3.2 install zbar
Gives the error message shown in the picture
sudo pip-3.2 install zbar
gives a similar error
Any ideas?
(I do have it installed with Python 2.7)
UPDATE: Both libzbar-dev and python3-dev are up to date. Still...
No module named 'zbar'
assuming you're using a debian derivative (like ubuntu), you need to install zbar's developement package, which contains the header file zbar.h
$ sudo apt-get install libzbar-dev
for redhat/fedora systems:
$ sudo yum install zbar-devel
and probably python's dev package too:
$ sudo apt-get install python3-dev
or you can use pip install zbar-py
https://pypi.org/project/zbar-py/
Try the following code after entering sudo mode:
yum install zbar-devel
This should work for fedora.
Bumping #herve solution
On ubuntu and on Mint
sudo apt-get install python-zbar libzbar-dev python-qrtools
pip install libzbar-cffi==0.2.1

ImportError: No module named 'psycopg2'

I've already installed the dependencies with sudo apt-get build-dep python-psycopg2 and then installing psycopg2 with sudo pip install psycopg2 and even with easy_install psycopg2. But even after all this, if I run python3 code.py I get
ImportError: No module named 'psycopg2'
If I run sudo apt-get build-dep python3-psycopg2 I get
Picking 'psycopg2' as source package instead of 'python3-psycopg2'
0 upgraded, 0 newly installed, 0 to remove and 144 not upgraded.
Same with sudo apt-get build-dep python-psycopg2
Please help.
its always better to work in virtualenv and not mess up with your system
try:
virtualenv -p /usr/bin/python3 test_env
source test_env/bin/activate
pip install psycopg2
run python and try to import
if you insist on installing it on your systems python try:
pip3 install psycopg2
If you are using the Anaconda distribution, make sure to go with:
conda install -c anaconda psycopg2=2.6.2
https://anaconda.org/anaconda/psycopg2
try:
# debian like
$ sudo apt-get install python3-dev
$ pip3 install psycopg2
# check installation
$ python3
import psycopg2
I faced the same issue. I tried
'sudo apt-get build-dep python-psycopg2'
It didn't work.
I was trying to connect to a postgres database. It turns out that I didn't have postgresql installed. Once I installed it, the error went away.
In my case, pip3 install psycopg2 made psycopg3 available for python3, while I was trying to execute my code in python 2.7 by default
so changing my call from
python foo.py to python3 foo.py helped

Installing Python's libxml2dom on Ubuntu 11.04

Interested in using libxml2dom in a Python script of mine to (obviously) parse some XML.
When I attempt to import "libxml2dom" I receive the error message "ImportError: No module named libxml2dom"
I can't seem to find it in the apt-get repo
It doesn't seem to be present within easy_install.
I already have libxml2 installed.
How can I / where can I install this from?
pip install works for me on Ubuntu 11.04 (python 2.7)
$ sudo apt-get install python-pip
$ sudo pip install libxml2dom

Categories