Python 3 can't import PyGObject - python-3.x

I'm trying to use PyGObject with Python 3, (either on Debian or Linux Mint) so I can use Gtk3+ and Glade for creating GUIs.
The problem is this:
In Python 3:
import gi
says module 'gi' not found.
I installed python3-gi from the repository, and Python 3 still says module not found when I try to import it.
However, Python 2 detects the module.
In Python 2, if I do
import gi
It works, but not with Python 3. I'm only interested in Python 3.
Any suggestions?

I ended up going with a different Linux distro which had PyGObject already installed for Python 3 - Ubuntu-MATE. Before, I was using Linux Mint.

the solution which worked out for me
pip install pycairo
pip install pyGObject

Related

no module named `numpy` in python 3.6 interpreter

I'm using Python 3.6 v in Ubuntu 18.04LTS. I installed numpy package using pip. When i used Python 3.6 interpreter it throws
ModuleNotFoundError: No module named 'numpy' and for Python2.7
interpreter it didn't throws any error. Any suggestions will be very helpful. I searched in google and github nothing helped me.
Based on the outputs you posted -
your pip and python are pointing to version 2.7
if you try pip install numpy you will install into your python 2.7 env
if you start python interpreter by default you'll be starting python2.7 and you should be able to find numpy package installed.
if you want to do the same in python3.xx use python3 , pip3 or use
virtual environments

Installing pyflann through conda and importing on python 3.5

I would like to use the package pyflann on python 3.5 (Win-64)
I use the app spyder from Anaconda 3 to write and compile my scripts.
I have installed the package pyflann using command prompt and conda. It seems that the installation was successful since when I type
conda list
in the command prompt, the list displayed includes
flann 1.8.3 3 ccordoba12
However, I am unable to import flann or pyflann into python.
import flann or import pyflann
yields :
no module named (flann or pyflann).
I have tried a few other approaches from recommendations on this site without success and resulting in similar failures outlined in other questions on the site. I could really use a concise step-by-step approach to successfully using pyflann on python 3.5 through spyder. Any thoughts or suggestions on completing the process I started through conda would be much appreciated
The conda package flann contains the library for flann.
The conda package pyflann contains the python bindings for this library.
Try the following:
(nasa) [rovers#mars ~]# conda install -c conda-forge pyflann
(nasa) [rovers#mars ~]# python -c 'import pyflann; print pyflann.__path__'
['/conda/lib/python2.7/site-packages/pyflann']

pyperclip module in python 3.4 not in python 3.5

I am completely new to programming and Linux OS.
In my Linux machine, I edited my bashrc so that when I type python, it calls python3. I have python 3.4 and python 3.5.2 installed. Recently, I install this module pyperclip using pip3 install.
My problem is when at python 3.5.2, the pyperclip module couldn't be found, I couldn't import it at terminal. When at python 3.4, I get to import the module.
Being completely new to Linux, I have no idea how to access the "pyperclip" module via python 3.5.2
I bought this book "Automate the Boring Stuff with Python." and the projects are really interesting.
Is it advisable to have more than one version of Python in my machine? Can I just use only one? How to I import pyperclip module in python 3.5.2?
Try this in Terminal.
pip3 install
pip3 install setuptools
pip3 install pyperclip
However you may need to have downloaded the zip pyperclip module first. Mine was in my Downloads directory on my Mac before I ran the previous three pip lines in Terminal.

installed python module in raspbian jessie will not work in python script

I'm pretty new to Python and programming in general. I'm attempting to use the forecastio module in a Python script on my Raspberry Pi. Its running Raspbian Jesse. I've installed the module like so:
sudo pip install python-forecastio
the installation was successful, but whenever I attempt to use the module in my script (import forecastio) none of the module methods work. I get this error:
import forecastio
ImportError: No module named 'forecastio'
I've tried rebooting after the module installation. It seems that Python just isn't recognizing the module. What am I missing?
Per default the command pip refers to the python 2.7 version of pip.
If you want to use the forecastio module in a python 3 script, you have to use pip3 to install it.

Python3 can't find urllib3

I have Python 2.7.3 installed alongside Python 3.2.3 on an Ubuntu system.
I've installed urllib3 using pip and can import it from the python shell. When I open the python3 shell, I get a can't find module error when trying to import urllib3. help('modules') from within the shell also doesn't list urllib3.
Any ideas on how to get python3 to recognize urllib3?
You need to install it for each version of Python you have - if pip installs it for Python 2.7, it won't be accessible from 3.2.
There doesn't seem to be a pip-3.2 script, but you can try easy_install3 urllib3.

Resources