简体   繁体   English

使用Anaconda或Canopy安装Python模块

[英]Installing Python modules with Anaconda or Canopy

I have played around with Python a little but never have I had to install my own packages. 我已经玩过Python了一点,但是从来没有安装自己的软件包。 I am currently trying to write a program that reads in 'tiff' files so I'm trying to install the 'libtiff' package and I'm having a nightmare! 我目前正在尝试编写一个读取“ tiff”文件的程序,因此我正在尝试安装“ libtiff”软件包,而我噩梦般的!

First, I was using the Anaconda distribution and the phrase 'conda install libtiff' which would tell me the install was successful. 首先,我使用的是Anaconda发行版和短语“ conda install libtiff”,它告诉我安装成功。 However then I was never able to find libtiff in the Spyder IDE or ipython console. 但是后来我再也无法在Spyder IDE或ipython控制台中找到libtiff。

Having used Canopy in the past, I uninstalled Anaconda and gave Canopy another shot using 'pip install libtiff', however I receive an error saying it failed with error code 1 and I don't know what this is. 过去使用过Canopy后,我卸载了Anaconda,并使用'pip install libtiff'给Canopy了另一张照片,但是我收到一条错误消息,错误代码为1,但我不知道这是什么。

I must be missing something fairly crucial but installing this module is proving almost impossible! 我肯定错过了一些相当关键的东西,但是事实证明安装此模块几乎是不可能的!

Conda's libtiff package is the C library, not the Python library. Conda的libtiff包是C库,而不是Python库。 The easiest way to get it would be to use conda to install the dependencies (like libtiff , numpy ), and then use pip to install libtiff ( pip install libtiff ). 最简单的方法是使用conda安装依赖项(如libtiffnumpy ),然后使用pip安装libtiffpip install libtiff )。

Using ! 使用! on the IPython console within spyder allows you to use pip . 在spyder中的IPython控制台上,您可以使用pip So, in the example, you could do: 因此,在示例中,您可以执行以下操作:

In [1]: !pip install libtiff

Note, this is also available (though perhaps unreliably) on the Python console for Spyder versions before ~2.3.3. 请注意,在〜2.3.3之前的Spyder版本的Python控制台上也可以使用(尽管可能不可靠)。

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

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