how to install packages from pypi to anaconda?

2.8k views Asked by At

I've been using Anaconda in Window for all my python coding. I've got a few questions:

  1. How do I check all the existing packages/modules I've installed? What commands do I need to type?

  2. How do I install third-party packages, especially those available in pypi? Sometimes when I download some packages like opencv, I just need to copy the file to the folder 'C:\Users\user\Anaconda\Lib\site-packages', and then type 'import cv2' in the ipython console (I'm using Spyder which is included in Anaconda), which is really easy. But more often, when I see some packages in pypi, I need to download the gz file. Inside the folder, there is a setup.py. When I try to run it, I get errors, like the following:

    SystemExit: usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2     [cmd2_opts] ...]
       or: setup.py --help [cmd1 cmd2 ...]
       or: setup.py --help-commands
       or: setup.py cmd --help
    
    error: no commands supplied
    

    What's wrong? Do I need to unzip the gz file into some specified folders first before running setup.py? Do I need to type any commands or codes in the ipython console?

Thanks

1

There are 1 answers

2
DrBwts On BEST ANSWER

1) Find the installation directory and look in the packages directory

2) From the Anaconda command line,

conda install <pkg name>

or if its in a tarball

conda install <tar-file-name>.tar

Anaconda FAQ