简体   繁体   English

Pip没有正确安装包

[英]Pip not installing package properly

So I am trying to get hmmlearn working in Jupyter, and I have come across an error while installing Hmmlearn using pip .所以我试图让 hmmlearn 在 Jupyter 中工作,但我在使用pip安装 Hmmlearn 时遇到了错误。 I have tried this solution , but it didn't work.我试过这个解决方案,但没有奏效。

It seems to me that pip does install the _hmmc file, but it does so incorrect.在我看来pip确实安装了 _hmmc 文件,但它确实不正确。 instead it has the name取而代之的是它的名字

_hmmc.cp35-win_amd64 _hmmc.cp35-win_amd64

and the file extesion is .PYD , instead of .c并且文件扩展名是.PYD ,而不是.c

When I run the code to import it, I get this error :当我运行代码以导入它时,出现此错误:

    ImportError                               Traceback (most recent call last)
    <ipython-input-1-dee84c3d5ff9> in <module>()
          7 import os
          8 from pyAudioAnalysis import audioBasicIO as aB
    ----> 9 from pyAudioAnalysis import audioAnalysis as aA

    C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioAnalysis.py in <module>()
         15 import audioFeatureExtraction as aF
         16 import audioTrainTest as aT
   --->  17 import audioSegmentation as aS
         18 import audioVisualization as aV
         19 import audioBasicIO

    C:\Users\gover_000\Documents\GitHub\Emotion-Recognition-Prototype\pyAudioAnalysis\audioSegmentation.py in <module>()
         16 import sklearn
         17 import sklearn.cluster
    ---> 18 import hmmlearn.hmm
         19 import cPickle
         20 import glob

    C:\Users\gover_000\Anaconda3\envs\python2\lib\site-packages\hmmlearn\hmm.py in <module>()
         19 from sklearn.utils import check_random_state
         20 
    ---> 21 from .base import _BaseHMM
         22 from .utils import iter_from_X_lengths, normalize
         23 

    C:\Users\gover_000\Anaconda3\envs\python2\lib\site-packages\hmmlearn\base.py in <module>()
         11 from sklearn.utils.validation import check_is_fitted
         12 
    ---> 13 from . import _hmmc
         14 from .utils import normalize, log_normalize, iter_from_X_lengths
         15 

    ImportError: cannot import name _hmmc 

I don't know why pip just doesn't install it correctly, even when I tried to use --no-cache-dir我不知道为什么pip没有正确安装它,即使我尝试使用--no-cache-dir

Edit: So i figured out what the problem was.编辑:所以我想出了问题所在。 my active python enviroment was python 3.5, as i was manually transferring the installed files to my enviroment, it failed because i had the wrong version.我的活动 python 环境是 python 3.5,因为我手动将安装的文件传输到我的环境,它失败了,因为我的版本错误。 I had to change my active python enviroment: using activate <my_enviroment name> after that i could just use pip to install it again and it worked this time.我不得不更改我的活动 python 环境:使用activate <my_enviroment name>之后我可以使用pip再次安装它,这次它工作了。

Looking at your error message I guess that you have downloaded the hmmlearn package from GIT.查看您的错误消息,我猜您已经从 GIT 下载了 hmmlearn 包。 Have you tried using a wheel (*.whl) file instead?您是否尝试过使用轮子 (*.whl) 文件? You can download one from here .你可以从这里下载一个。 Check out which version fits your python installation.检查哪个版本适合您的 python 安装。

Then use:然后使用:

pip install <the_wheel_that_corresponds_to_your_python_version>.whl

Hope it helps.希望它有帮助。

So i figured out what the problem was.所以我想出了问题所在。 my active python enviroment was python 3.5, as i was manually transferring the installed files to my enviroment, it failed because i had the wrong version.我的活动 python 环境是 python 3.5,因为我手动将安装的文件传输到我的环境,它失败了,因为我的版本错误。 I had to change my active python enviroment: using activate <my_enviroment_name> after that i could just use pip to install it again and it worked this time.我不得不更改我的活动 python 环境:使用activate <my_enviroment_name>之后我可以使用pip再次安装它并且这次它工作了。

not sure if it could be helpful to anyone but I installed hmmlearn as follows in my Jupyter Lab:不确定它是否对任何人有帮助,但我在我的 Jupyter 实验室中按如下方式安装了 hmmlearn:

import sys
!{sys.executable} -m pip install hmmlearn

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM