Cannot Install Python Modules after Installing Anaconda

前端 未结 6 1587
故里飘歌
故里飘歌 2021-01-06 14:38

[New Note: I cannot install through binstar or anaconda. Why can\'t I install in python, outside of anaconda? Is there a way to get my computer to stop using the anaconda

相关标签:
6条回答
  • 2021-01-06 14:46

    Your problem is that you do not have a C compiler (gcc is a C compiler), which is needed in order for the package you downloaded to be installed. This problem is completely independent of Anaconda.

    Your options are:

    • Install a C compiler, and then build the package sources you downloaded (via the python setup.py install command)
    • Find a pre-compiled version of the package.

    You did not say what platform you are on. I suspect you are on a Mac or on Windows, since most Linux installations have a working C compiler.

    If you are on a Mac, please install Xcode via the App Store. This is the overall recommended way to get a C compiler on Mac OS X.

    If you are on Windows, you should install the MinGW package via:

    conda install mingw
    

    Then you can try doing "python setup.py install".

    BTW, the difficulties you are encountering with building packages is common, and it's why people use a distribution like Anaconda, instead of struggling with build issues on their own. If you want to only use Anaconda part of the time, and use your system Python, then you can just set your PATH variable by editing ~/.bash_profile and commenting out the line at the very bottom which adds anaconda/bin/ to your path.

    Managing packages across two different Python installations is going to cause you more headaches than it's generally worth. I would recommend just using Anaconda, unless you have a very good reason to stick with the system Python.

    0 讨论(0)
  • 2021-01-06 14:51

    You could try to find someone who's built this package on binstar, which is the package hosting site for Anaconda.

    I found https://binstar.org/dhirschfeld/pyodbc/3.0.7/files, which may work for you if you have 64-bit Windows. You can try conda install -c https://conda.binstar.org/dhirschfeld pyodbc.

    0 讨论(0)
  • 2021-01-06 14:51

    It looks like you've downloaded the source for PyODBC and it contains some code that needs to be compiled (C/C++). Your error refers to the fact that you don't have gcc (a compiler) installed.

    You can either install mingw32 or gcc (through cygwin) to build and install the module, but the easiest thing to do is probably just download the ODBC Windows installer from their Google Code site.

    0 讨论(0)
  • 2021-01-06 15:05

    Enthought provides pre-built PyODBC package downloads in its repository for the standard platforms. You will need a subscription to access this package though (this one is not part of the free Canopy Express version). If you are a faculty member or student, then you can get a free academic subscription: https://www.enthought.com/products/canopy/academic/

    0 讨论(0)
  • 2021-01-06 15:07

    I suggest trying "conda install" + PackageName. If it fails installing using conda, it may automatically jump to using pip with success.

    0 讨论(0)
  • 2021-01-06 15:12

    check out my answer over here. https://stackoverflow.com/a/21764422/129600

    basically, the pyodbc source code is missing stuff/has other out-of-date stuff, so the fix mentioned there should hopefully work for you.

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