Python 如何在 anaconda 中安装软件包?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36164986/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 17:30:18  来源:igfitidea点击:

How to install package in anaconda?

pythonpackageinstallanacondamusic21

提问by Július Marko

I want to add music package to anaconda interpreter. I'm using ubuntu 14.04 64bit. I downloaded music21-1.9.3.tar.gz from anaconda cloud. I unpacked it to anaconda3/pkgs

我想将音乐包添加到 anaconda 解释器。我正在使用 ubuntu 14.04 64 位。我从anaconda cloud下载了music21-1.9.3.tar.gz。我把它解压到 anaconda3/pkgs

ext                installer.py  music21           PKG-INFO   setup.cfg
installer.command  MANIFEST.in   music21.egg-info  README.md  setup.py

I found nothing on the web, or doesn't work. How can I install it?

我在网上找不到任何东西,或者不起作用。我该如何安装?

回答by RasikhJ

Are you using Windows? If so, open up a Command Prompt window.

您使用的是 Windows 吗?如果是这样,请打开命令提示符窗口。

What I like to do is Copy the Link Address of the package that I would like to install. In this case, a simple google search lead me to a popular python package site : https://pypi.python.org/pypi/music21/1.9.3

我喜欢做的是复制我想安装的包的链接地址。在这种情况下,一个简单的谷歌搜索将我带到一个流行的 python 包站点:https: //pypi.python.org/pypi/music21/1.9.3

I right-click the tar.gz hyperlink and click "Copy Link Address" to get this : https://pypi.python.org/packages/source/m/music21/music21-1.9.3.tar.gz#md5=d271e4a8c60cfa634796fc81d1278eaf

我右键单击 tar.gz 超链接并单击“复制链接地址”以获取此信息:https: //pypi.python.org/packages/source/m/music21/music21-1.9.3.tar.gz#md5= d271e4a8c60cfa634796fc81d1278eaf

Now to install this, in your command prompt window, type the following :

现在要安装它,在您的命令提示符窗口中,键入以下内容:

pip install https://pypi.python.org/packages/source/m/music21/music21-1.9.3.tar.gz#md5=d271e4a8c60cfa634796fc81d1278eaf

or

或者

conda install https://pypi.python.org/packages/source/m/music21/music21-1.9.3.tar.gz#md5=d271e4a8c60cfa634796fc81d1278eaf

And it should automatically download the package from that link address, unzip it, and then attempt to install it in your python environment.

它应该会自动从该链接地址下载包,解压缩它,然后尝试将它安装到你的 python 环境中。

It's good to know how to install python packages manually as well for distributions that don't lend themselves as easily to cross-platform auto-installations.

最好知道如何手动安装 python 包,以及对于不容易跨平台自动安装的发行版。

What you would do is unzip the tar.gz file ( or any other compressed package file ) until you have a folder directory with a "setup.py" file name. You would go into your command prompt window and "cd" into that directory.

您要做的是解压缩 tar.gz 文件(或任何其他压缩包文件),直到您拥有一个带有“setup.py”文件名的文件夹目录。您将进入命令提示符窗口并“cd”进入该目录。

Then you would call the Python Executable by typing "python" which lets the command prompt know that you are calling python to run your command and finish the line so in total it looks like this :

然后,您将通过键入“python”来调用 Python 可执行文件,这让命令提示符知道您正在调用 python 来运行您的命令并完成该行,因此总的来说它看起来像这样:

python setup.py install 

There you have it.

你有它。