Conda and Python Modules

ぐ巨炮叔叔 提交于 2019-12-03 14:05:37

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

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

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

conda update conda.

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

conda update anaconda.

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: What is binstar?

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

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: Nothing. You can just run it from the IPython GUI using %run MyScript.py

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))

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

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: 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)?

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!