Windows의 Anaconda Python에 Keras와 Theano를 어떻게 설치합니까?
다음 Keras 패키지를 사용하여 Python의 신경망에서 작업하려고합니다.
from keras.utils import np_utils
from keras.layers.core import Dense, Activation, Dropout
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution2D, MaxPooling2D
from keras.optimizers import SGD
그러나 다음과 같은 오류가 발생합니다.
15 import theano
---> 16 from theano import gof
17 from theano.compat.python2x import partial
18 import theano.compile.mode
ImportError: cannot import name gof
설치된 conda install keras. 나중에를 사용하려고했지만 pip install Theano작동하지 않았습니다. 를 사용하여 설치하려고 pip install git했지만이 오류가 발생했습니다. cannot find command git.그래서 Git을 설치하고 환경 변수를 설정했습니다.
그렇다면 이러한 패키지를 설치하는 절차가 있습니까?
같은 문제에 대한 나의 해결책
- TDM GCC x64를 설치합니다 .
- Anaconda x64를 설치합니다 .
- Anaconda 프롬프트를 엽니 다.
- 운영
conda update conda - 운영
conda update --all - 운영
conda install mingw libpython - 최신 버전의 Theano를 설치하십시오.
pip install git+git://github.com/Theano/Theano.git - 운영
pip install git+git://github.com/fchollet/keras.git
비결은 Python 용 환경 / 작업 공간을 만들어야한다는 것 입니다. 이 솔루션은 Python 2.7에서 작동해야하지만 keras 작성 당시에는 특히 최신 아나콘다가 설치되어있는 경우 케 라스를 Python 3.5에서 실행할 수 있습니다 (이는 이해하는 데 시간이 걸리므로 Python에 KERAS를 설치하는 단계를 간략하게 설명하겠습니다. 3.5) :
Python 3.5 용 환경 / 작업 공간 만들기
C:\conda create --name neuralnets python=3.5C:\activate neuralnets
모든 것을 설치합니다 (각 줄의 괄호 안에있는 신경망 작업 공간에 유의하십시오). 각 단계에서 설치하려는 종속성을 수락하십시오.
(neuralnets) C:\conda install theano(neuralnets) C:\conda install mingw libpython(neuralnets) C:\pip install tensorflow(neuralnets) C:\pip install keras
테스트 해보십시오.
(neuralnets) C:\python -c "from keras import backend; print(backend._BACKEND)"
작업 공간에서 작업하려면 항상 다음을 수행해야합니다.
C:\activate neuralnets
예를 들어 Jupyter를 다음과 같이 시작할 수 있습니다 (이 환경 / 작업 공간에도 Jupyter가 설치되어 있다고 가정).
C:\activate neuralnets
(neuralnets) jupyter notebook
다음 URL에서 conda 환경 / 작업 공간 관리 및 생성에 대한 자세한 내용을 읽을 수 있습니다. https://conda.io/docs/using/envs.html
아나콘다가있는 창에서 conda 프롬프트로 가서이 명령을 사용하십시오
conda install --channel https://conda.anaconda.org/conda-forge keras
나는 macOS를 사용하고 같은 문제를 겪었습니다.
터미널에서 다음 명령을 실행하면 저를 구했습니다.
conda install -c conda-forge keras tensorflow
도움이 되었기를 바랍니다.
Keras mnist_cnn.py 예제와 같은 theano 백엔드로 CNN을 훈련하려는 경우 :
theano bleeding edge 버전을 사용하는 것이 좋습니다. 그렇지 않으면 어설 션 오류가 발생할 수 있습니다.
- Theano 블리딩 에지 실행
pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git - Keras를 실행합니다 (1.0.8과 유사 함).
pip install git+git://github.com/fchollet/keras.git
아래 주어진 명령으로 설치 conda install -c conda-forge keras
이것은 "CondaError : 존재하지 않는 소스를 링크 할 수 없습니다"라는 오류입니다. win 10에서 얻을 수 있습니다. 오류로 인해이 명령을 명령 줄에 넣으십시오.
conda update conda
this work for me .
In windows environment with Anconda. Go to anconda prompt from start. Then if you are behind proxy then .copndarc file needs to eb updated with the proxy details.
ssl_verify: false channels: - defaults proxy_servers: http: http://xx.xx.xx.xx:xxxx https: https://xx.xx.xx.xx:xxxx
I had ssl_verify initially marked as 'True' then I was getting ssl error. So i turned it to false as above and then ran the below commands
conda update conda conda update --all conda install --channel https://conda.anaconda.org/conda-forge keras conda install --channel https://conda.anaconda.org/conda-forge tensorflow
My python version is 3.6.7
Anaconda with Windows
- Run anaconda prompt with administrator privilages
- conda update conda
- conda update --all
- conda install mingw libpython
- conda install theano
After conda commands it's required to accept process - Proceed ([y]/n)?
'program story' 카테고리의 다른 글
| 가능한 인터뷰 질문 : 모든 겹치는 간격을 찾는 방법 (0) | 2020.11.20 |
|---|---|
| manage.py runserver (0) | 2020.11.20 |
| MTOM은 어떻게 작동합니까? (0) | 2020.11.19 |
| postDelayed에 의해 추가 된 핸들러 객체에서 실행 파일을 제거하는 방법은 무엇입니까? (0) | 2020.11.19 |
| 백그라운드 스레드에서 NSTimer를 어떻게 생성합니까? (0) | 2020.11.19 |