General Question

LostInParadise's avatar

Python users, how do I install a library?

Asked by LostInParadise (32215points) July 3rd, 2014

I love working with the language, but installing new packages drives me nuts. I want to add the ruffus pipeline package. I have downloaded from the site, but can’t get the program to install. What are the steps that I have to go through?

Observing members: 0 Composing members: 0

5 Answers

dina_didi's avatar

I found this. Does it help?

funkdaddy's avatar

From the documentation

sudo pip install ruffus—upgrade

or

easy_install -U ruffus

Those would be console commands on *nix and Mac. More installation notes.

LostInParadise's avatar

Thanks guys. I finally was able to do it. It took some fiddling. There does not seem to be a simple one-step way of adding a library, or at least not one that I have been able to put together. It is a shame. Python is really an easy language to learn and to use. I have seen it described as executable pseudo-code, which is some high praise that I would go along with. For those who are not programmers, it means that if you wanted to describe how to process some data using an ad hoc make believe programming language, it would probably look a lot like Python.

dina_didi's avatar

@LostInParadise I have not tried to learn Python because I thought for a reason that it was difficult and I would not be able to do many things with it. But I haven’t written or read code in Python. Is it easier than c or java?

LostInParadise's avatar

I work mostly with C# at work. I found that learning Python was easier than learning C. Mostly I use Python for small programs. I know that there are some platforms for creating larger projects, but I have not yet had the need. One feature that I find convenient is that Python is interpreted code. If I create a program in Visual Studio, in addition to the code file there is a project file, a solution file and an executable. In Python there is just the one file. That is a nice feature for writing small programs.

Some of the things I like about Python:
Flip the values of two variables in a single line of code:: a, b = b, a
Define a function inside of another function.
Return a function from a function based on input parameters
You can use -1 as the index of the last item of an array, -2 for the second to last, etc.

Python uses indentation in place of the braces used by C. It took some getting used to, but I came to prefer this approach. The Python editor helps by keeping track of the current level of indentation. In general, Python code is more compact and more readable than C code.

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther