Skip to content Skip to sidebar Skip to footer

Importing Modules That Work In Python 2.7 But Not Python 3.4

I have previously been using PyCharm with Python 2.7, and have been able to import the module sklearn, which was intalled via sudo apt-get install python-sklearn. However, I have n

Solution 1:

You'll need to install sklearn for Python 3.4. Ubuntu currently does not have a python3-sklearn package available, unfortunately, so you'll have to follow the installations instructions to install this yourself.

This includes installing build dependencies:

sudo apt-get install build-essential python3-dev python3-setuptools \
                     python3-numpy python3-scipy \
                     libatlas-dev libatlas3gf-base

You may have to set the right implementation (Ubuntu 13.04 and newer):

sudo update-alternatives --set libblas.so.3 \
    /usr/lib/atlas-base/atlas/libblas.so.3
sudo update-alternatives --set liblapack.so.3 \
    /usr/lib/atlas-base/atlas/liblapack.so.3

followed by

pip3 install --user -U scikit-learn

for a local install (your account only), or

sudo pip3 install -U scikit-learn

for a global install.

Post a Comment for "Importing Modules That Work In Python 2.7 But Not Python 3.4"