简体   繁体   中英

how to install packages from pypi to anaconda?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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