ImportError: "MNIST" nomi import qilinmaydi

Men qabariq, sklearn va h.k. kabi boshqa barcha paketlarni o'rnatishga muvaffaq bo'ldim, ammo mnist to'plami meni xato deb atadi. Men sudo-pipsni o'rnatishga harakat qilyapman, lekin buni ham aytadi

applesys$ pip install mnist
Requirement already satisfied: mnist in            /Users/applesys/anaconda3/lib/python3.5/site-packages
Requirement already satisfied: numpy in /Users/applesys/anaconda3/lib/python3.5/site-packages (from mnist)
applesys$ sudo pip install mnist
Password:
The directory '/Users/applesys/Library/Caches/pip/http' or its parent             directory is not owned by the current user and the cache has been disabled.     Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/applesys/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: mnist in    /Users/applesys/anaconda3/lib/python3.5/site-packages
Requirement already satisfied: numpy in /Users/applesys/anaconda3/lib/python3.5/site-packages (from mnist)

import error

3

6 javoblar

python-mnist va mnist ikki xil paket bo'lib, ikkalasi ham mnist . Kerakli paket python-mnist . Shunday qilib:

pip install python-mnist

mnist to'plamini quyidagicha olib tashlash kerak bo'ladi:

pip uninstall mnist

Keyinchalik import idorasi ishlashi kerak.

4
qo'shib qo'ydi

Siz noto'g'ri mnist kodini ishlatasiz. lasagne namunasiga amal qilishingiz kerak; load_data funktsiyasi bilan mnist.py deb nomlangan faylga ega. Sizga misol faylga borishingizni tavsiya eting, kodni ko'chirib oling va lasagne_mnist.py sifatida yozib oling, shuning uchun mnistdan import qilsangiz, siz import qilayotgan mnistlardan aniq bo'ladi. Python yo'lidagi katalogni va uni tan olish uchun init .py faylini saqlab qo'yishni unutmang. unda shunday qilishingiz mumkin:

<div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code">

from lasagne_mnist import load_dataset
X_train, y_train, X_valid, y_valid, X_test, y_test = load_dataset()
</div> </div>

u ma'lumotlarni yuklab olish kerak

1
qo'shib qo'ydi

Masalan, mavjud bo'lmagan vazifani chaqirishga harakat qilyapsiz

Import muddati Time.sleep (9)

Bu erda 9 ga yaqin uyqu oladi, lekin modulni moduldan chaqirishga harakat qilsangiz

Vaqtni import qilish vaqti Vaqti-vaqti bilan qarash va masalan, vaqt deb ataladigan vazifani topasiz

Vaqt vaqti

In this example the time function is existing so it will work but instead of Vaqt vaqti it will be used as time

Before: current_time = Vaqt vaqti After: current_time = time (Would recommend importing it as a diffrent name example: from time import time as currentime)

Agar modulda funktsiyani chaqirishga harakat qilsangiz, iltimos, ismingizni qayta ko'rib chiqing Modulni chaqirishga harakat qilsangiz, buni bajaring

Import mnist

Or if there is a function inside the module: from mnist Import mnist no caps

1
qo'shib qo'ydi

mnist paketini import qilishning eng to'g'ri usuli:

import mnist

Yaxshi po'pirmali ishni bajarish uchun sizning paketlaringiz to'g'ri o'rnatilgan bo'lishi kerak.

0
qo'shib qo'ydi

Xuddi shu muammo bor edi. "Mnist" modulini ushlab turuvchi "mnist" jildini tekshirayotib, asosiy modulda "MIST" ni topa olmadim

    __init__.py

Biroq, MNIST klassi xuddi shu joyda "loader.py" faylida topilgan. "Loader.py" faylini Python skripti joylashgan shu papkaga nusxalashdi (bu mnist modulidan foydalanishga harakat qilaman). Endi, o'rniga:

    from mnist import MNIST

Men foydalanar:

    from loader import MNIST

Hozir hamma narsa yaxshi ishlaydi.

0
qo'shib qo'ydi
Men bu muammo Windows mashinasida bo'ldim. PIP, mnistning so'nggi versiyasini ishlatganimni xabar qildi. Biroq, github.com/sorki/python-mnist manzilida mavjud bo'lgan kodda tekshiruv Windows-ning o'rnatilishi dolzarb emas edi. Men oxirgi github versiyasini (python-mnist 0.3) o'rnatdim va endi "mnist import MNIST" dan foydalanib, yaxshi ishlaydi.
qo'shib qo'ydi muallif Markacho, manba

Men faqat python va Mashinani o'rganish uchun boshlang'ichman. Men foydalanadigan python buyrug'i ham "mnist.py" deb nomlangan edi, bu esa xatolarga sabab bo'ldi (men buni qanday deb o'ylayman) .Shu haqida men amin emasman Lekin bu sizga yordam berishi mumkin.

0
qo'shib qo'ydi
Python
Python
372 ishtirokchilar

Bu guruh python dasturlash tilini muhokama qilish uchun. Iltimos, o'zingizni hurmat qiling va faqat dasturlash bo'yicha yozing. Botlar mavzusini @botlarhaqida guruhida muhokama qling! FAQ: @PyFAQ Offtopic: @python_uz_offtopic

Python offtopic group !
Python offtopic group !
150 ishtirokchilar

@python_uz gruppasining offtop gruppasi. offtop bo'lsa ham reklama mumkin emas ) Boshqa dasturlash tiliga oid gruppalar @languages_programming