Numpy Import Throws Attributeerror: 'Module' Object Has No Attribute 'Core'

AttributeError: 'module' object has no attribute

You have mutual top-level imports, which is almost always a bad idea.

If you really must have mutual imports in Python, the way to do it is to import them within a function:

# In b.py:
def cause_a_to_do_something():
import a
a.do_something()

Now a.py can safely do import b without causing problems.

(At first glance it might appear that cause_a_to_do_something() would be hugely inefficient because it does an import every time you call it, but in fact the import work only gets done the first time. The second and subsequent times you import a module, it's a quick operation.)

Python module 'datetime' has no attribute 'datetime_CAPI'

I found the problem, it was a Python compilation issue. I used the following commands to compile Python and the problem was solved.

CC=arm-linux-gnueabihf-gcc CXX=arm-linux-gnueabihf-g++ AR=arm-linux-gnueabihf-ar \
RANLIB=arm-linux-gnueabihf-ranlib \
./configure --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf \
--build=x86_64-linux-gnu --prefix=$HOME/python3.8.10 \
--disable-ipv6 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no \
ac_cv_have_long_long_format=yes --enable-shared

make HOSTPYTHON=$HOME/python3.8.10 \
BLDSHARED="arm-linux-gnueabihf-gcc -shared" CROSS-COMPILE=arm-linux-gnueabihf- \
CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=arm-linux-gnueabihf

make altinstall HOSTPYTHON=$HOME/python3.8.10 \
BLDSHARED="arm-linux-gnueabihf-gcc -shared" CROSS-COMPILE=arm-linux-gnueabihf- \
CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=arm-linux-gnueabihf \
prefix=$HOME/python3.8.10/_install

While importing train_test_split from from sklearn.model_selection, why am I getting the error AttributeError: module 'attr' has no attribute 's' ?

This will solve your problem
Type these commands in terminal or in a notebook

pip uninstall attr
pip install attrs



Related Topics



Leave a reply



Submit