Importing modules that work in Python 2.7 but not Python 3.4

前端 未结 1 1625
无人及你
无人及你 2021-01-23 04:21

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-skle

相关标签:
1条回答
  • 2021-01-23 05:11

    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.

    0 讨论(0)
提交回复
热议问题