Conda和Python模块 [英] Conda and Python Modules

查看:131
本文介绍了Conda和Python模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可悲的是,我不明白如何安装随机python模块以便在我的Anaconda发行版的iPython笔记本中使用。问题更加复杂,因为我需要能够在不使用实时互联网连接的情况下完成这些工作。

Sadly, I do not understand how to install random python modules for use within iPython Notebooks with my Anaconda distribution. The issue is compounded by the fact that I need to be able to do these things without always using a live internet connection.

我经常遇到gcc编译问题,我可以用我的基本Python2.7安装模块,但不能用Conda或Anaconda / Python.exe安装。

Most frequently I run into a problem with gcc compiling, where I can install a module with my basic Python2.7, but not with Conda or with the Anaconda/Python.exe.


  • Conda是否只能安装某些模块,而不是所有有效的python模块?

  • Is Conda only able to install certain modules, as opposed to all valid python modules?

什么是binstar?

What is binstar?

我该怎么做,如果有的话,到一个普通的python模块,以使其成为Conda-ready,可以这么说?

What do I have to do, if anything, to a normal python module in order to make it "Conda-ready," so to speak?

从SourceForge或GitHub下载python模块或无论在哪里,我如何要求Conda从我的计算机上的源文件/二进制文件安装该模块(无需连接到互联网)?

Once I have downloaded a python module from SourceForge or GitHub or wherever, how can I ask Conda to install that module from the source files / binary on my computer (without having to connect to the internet)?

非常感谢帮助。

推荐答案


Q1:Conda是否只能够安装某些模块,而不是所有有效的python模块?

Q1: Is Conda only able to install certain modules, as opposed to all valid python modules?

如果我理解你的问题是正确的,那么它就是如何访问所有Anaconda软件包?

If I understood your question correct, then it is along the lines "How do I get access to all the Anaconda packages"?

A:您上线(!),打开您的cmd.exe或shell并键入:

A: You go online (!), open your cmd.exe or shell and type:

conda update conda

在提示时点击 y +输入。安装程序完成后,键入:

Hit y+enter when prompted. When the installer is done, you type:

conda update anaconda

如果在该过程中出现错误,那么我猜你的$ PATH $变量需要检查。谷歌这个问题,或 cd 进入anaconda文件夹并再试一次。如果仍然失败,请尝试从 http://continuum.io/downloads 下载anaconda软件包并再次安装并在提示将Anaconda设置为默认python时按 Y

If you get an error in that process, then I would guess your $PATH$ variable needs a check. Google this problem, or cd into the anaconda folder and try again. If it still fails, then try downloading the anaconda package from http://continuum.io/downloads and install it again and press Y when prompted to setup Anaconda as default python.


Q2:什么是binstar?

Q2: What is binstar?

A:包管理器。我认为你不需要它。

A: A package manager. I don't think you need it.


问题3:我需要做什么,如果有的话,按顺序正常的python模块使它成为康达准备好,可以这么说?

Q3: What do I have to do, if anything, to a normal python module in order to make it "Conda-ready," so to speak?

A:没什么。您可以使用%运行MyScript.py

A: Nothing. You can just run it from the IPython GUI using %run MyScript.py

以下是一个示例
让我们在一个名为script.py的文件中编写以下Python脚本: / p>

Here is an example: Let's write the following Python script in a file called script.py:

print("Running script.")
x = 12
print("'x' is now equal to {0:d}.".format(x))

现在,假设我们在这个文件所在的目录,我们可以通过输入以下命令在IPython中执行它:

Now, assuming we are in the directory where this file is located, we can execute it in IPython by entering the following command:

In [1]: %run script.py
Running script.
'x' is now equal to 12.
In [2]: x
Out[2]: 12

运行脚本时,控制台的标准输出显示任何print语句。在执行结束时,脚本中定义的x变量随后包含在交互命名空间中,这非常方便。

When running the script, the standard output of the console displays any print statement. At the end of execution, the x variable defined in the script is then included in the interactive namespace, which is quite convenient.


Q4:一旦我从SourceForge或GitHub或其他地方下载了python模块,我如何让Conda从我的计算机上的源文件/二进制文件中安装该模块(无需连接到互联网)?

Q4: Once I have downloaded a python module from SourceForge or GitHub or wherever, how can I ask Conda to install that module from the source files / binary on my computer (without having to connect to the internet)?

答:我不会手动从任何地方下载任何内容。如果必须,您可以在绝对必要时使用 pip easy_install ,但在您试用这些功能之前,请首先查看Anaconda文档 此处。有很多套餐,如果它们不能满足您的需求,我会感到惊讶。

A: I don't download anything from anywhere manually. If you have to you can use pip or easy_install when absolute necessary, but before you experiment with these functions, please start by checking the Anaconda docs here. There are plenty of packages, and I would be surprised if they do not cover your needs.

这篇关于Conda和Python模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆