Ivan219
Posts: 118
Joined: Sun Jul 05, 2015 10:01 pm

Install modules to python3.4

Tue Jun 07, 2016 8:54 am

I update my raspberry to Raspabian Jessie, installing new python version 3.4 How to install any modules to this version? Because all commands easy_install3 or pip3 install modules to python3.2. Please, help. I want when i write pip3 modules install to python 3.4
Last edited by Ivan219 on Tue Jun 07, 2016 10:27 am, edited 1 time in total.

Ivan219
Posts: 118
Joined: Sun Jul 05, 2015 10:01 pm

Re: Install modules to python3.4

Tue Jun 07, 2016 11:05 am

But I have python2,6 and python 2,7 modules installing to python2,7, how change links to pip3 from python3,2 to python3,4 and dpkg too, (in the past it was working, now i am backup from previous version of sd card, i forgot how to make it)

dgordon42
Posts: 788
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Install modules to python3.4

Tue Jun 07, 2016 12:16 pm

Modules written for Python 2 generally don't work in Python 3, and vice versa.
You can install pip for Python3 with:

Code: Select all

sudo apt-get install python3-pip
and use it to install Python3 modules.

More and more Python modules are now available in both Python 2 and Python 3 versions. For example, matplotlib can be installed on the Pi with:

Code: Select all

sudo apt-get install python-matplotlib
sudo apt-get install python3-matplotlib
Now, you have both versions.

Hope this helps,
Dave.

Ivan219
Posts: 118
Joined: Sun Jul 05, 2015 10:01 pm

Re: Install modules to python3.4

Tue Jun 07, 2016 12:43 pm

My problem is: all python3 modules installing to python 3.2 and before they were installed in python 3.4, (I reinstall os because i had some problems with starting). Pip3,4 don't help too

dgordon42
Posts: 788
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Install modules to python3.4

Tue Jun 07, 2016 1:18 pm

What does:

Code: Select all

python3 --version
cat /etc/os-release
report?

Dave.

Ivan219
Posts: 118
Joined: Sun Jul 05, 2015 10:01 pm

Re: Install modules to python3.4

Tue Jun 07, 2016 2:53 pm

Code: Select all

PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Code: Select all

Python 3.4.2

dgordon42
Posts: 788
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Install modules to python3.4

Tue Jun 07, 2016 3:30 pm

I'm thinking that you have Python3.2 and 3.4 installed. Python3.4.2 is the default in Jessie, which you have.
Do you know where the Python3.2 came from, did you upgrade your os from Wheezy to Jessie perhaps?

What does:

Code: Select all

whereis python3
report?

If you have both the 3.2 and 3.4 versions of Python installed, you could try:

Code: Select all

sudo apt-get purge python3.2
This should get rid of Python3.2.

You should find your Python modules in:

Code: Select all

/usr/lib/python*
The directory name indicates which versions of python the modules are for.

Dave.

Ivan219
Posts: 118
Joined: Sun Jul 05, 2015 10:01 pm

Re: Install modules to python3.4

Tue Jun 07, 2016 3:40 pm

Thank you! And the last question: python script gave error: no module pip - sudo name.py, but if i go from root user - it's works! How resolve it? I think, that problem in permissions.

dgordon42
Posts: 788
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Install modules to python3.4

Tue Jun 07, 2016 4:11 pm

Not sure, copy & paste the complete error message in code blocks.

Dave.

Ivan219
Posts: 118
Joined: Sun Jul 05, 2015 10:01 pm

Re: Install modules to python3.4

Tue Jun 07, 2016 4:50 pm

Code: Select all

 import pip #needed to use the pip functions
ImportError: No module named 'pip'

dgordon42
Posts: 788
Joined: Tue Aug 13, 2013 6:55 pm
Location: Dublin, Ireland

Re: Install modules to python3.4

Tue Jun 07, 2016 6:00 pm

Try:

Code: Select all

sudo apt-get update
sudo apt-get install python3-pip
This should install pip for Python3.
If you had to purge Python 3.2 earlier, you may have lost some modules, you can reinstall them with commands based on the above.

Hope this helps,
Dave.

Return to “Beginners”