I've installed Python 3.3 alongside Python 2.75 on my Ubuntu machine. The problem is that easy_install gets packages for the default, 2.75 version only, e.g:
easy_install pymongo
$ python
Python 2.7.4 (default, Apr 19 2013, 18:28:01)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymongo
>>>
But:
$ python3.3
Python 3.3.1 (default, Apr 17 2013, 22:30:32)
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymongo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'pymongo'
How can I install PyPi packages for the Python 3.3 installation?
You need easy_install3. In apt-get you get it by
apt-get install python3-setuptools
Related
I have been using lirc in Python 2.7 and Python 3.5.3 on Rpi3. Now I have installed Python 3.8.7 from source code, but I am not able to use lirc in this version of Python, but it still works in Python 3.5. apt-get reports that python3-lirc is already the newest version (1.2.1-2). How to get lirc work in both Python 3.5 and 3.8?
pi#RPi3:~ $ python
Python 3.8.7 (default, Jan 7 2021, 08:59:27)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lirc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'lirc'
>>>
pi#RPi3:~ $ python3.5
Python 3.5.3 (default, Nov 18 2020, 21:09:16)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lirc
>>> sockid=lirc.init("myProg", blocking = False)
>>>
It means that you installed lirc on only one of the two pythons.
Use the pip from your Python 3.8 to install lirc so that the module will also be accessible to your Python 3.8.
Module lirc has to be uninstalled with pip, then python-lirc can be installed in Python 3,8 as described in https://github.com/tompreston/python-lirc/issues/26 after installing cyhton with pip.
Actually I already installed tensorflow by using
$ pip install tensorflow
and it works well when I use
$ python
Python 2.7.15 (default, Jul 23 2018, 21:27:06)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>import tensorflow
>>>
but when I use python3 on command line
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>>
it shows an error, and it shows the same error when I use IDLE
use
pip3 install tensorflow
pip installs to default python directory. pip3 installs to python3
I wrote a basic Python 3 script that uses the Google Sheets API. It works on a system that defaults to Python 3 (Arch). I'm trying to run the same script on an Ubuntu 14.04 system, but I'm unable to load the apiclient library. I installed with the recommended
pip install --upgrade google-api-python-client
But I noticed I can only load the library in python 2.
Here's what I'm observing:
~ $ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from googleapiclient import discovery
>>> quit()
~ $ python3
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from googleapiclient import discovery
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'googleapiclient'
Any advice?
The Googleapiclient is installed only on python2 (Which i guess is your default python version) not python3.
Install Googleapiclient in python3 env using the following:
pip3 install --upgrade google-api-python-client
python -m pip install --upgrade google-api-python-client
I'm new to Ubuntu (14.04). I just installed django using sudo pip install Django.
This is what is happening:
rpr#rpr-Inspiron-3521:~$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>>
rpr#rpr-Inspiron-3521:~$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'django'
>>>
What should I do to be able to use Django from Python3.4?
Just write:
sudo pip3 install Django
But better use virtualenv like Daniel said.
Reference
If you cannot run pip3 install it with the following:
sudo apt-get install python3-setuptools
sudo easy_install3 pip
pip is presumably installed for Python 2, not Python 3. You may have a version named pip3 that targets Py3.
However, it would be better to use a virtualenv.
I am using MacOS X 10.7.5 and am a TOTAL newb at Python
I am pretty sure django installed correctly as per https://code.djangoproject.com/wiki/Distributions
$ sudo port install py27-django
---> Computing dependencies for py27-django
---> Cleaning py27-django
---> Scanning binaries for linking errors: 100.0%
---> No broken files found.
$ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named django
The issue was with that a prior Python was installed (2.7.1) previously and MacPorts installed a new one (2.7.6) but did not update the Mac Sym links etc
So I had to futz with my PATH
$ vi ~/.bash_profile
.
.
export PATH=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin:$PATH
.
.
$ source ~/.bash_profile
$ python --version
Python 2.7.6
$ python
Python 2.7.6 (default, Nov 12 2013, 13:12:10)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print django.get_version()
1.5.1