简体   繁体   English

如何将外部软件包安装到Canopy中?

[英]How to install external packages into Canopy?

I am new to python and Canopy. 我是python和Canopy的新手。 I have searched for the possible solutions online, including the support forum of Enthought Canopy, but failed to solve my problem by following the instructions under other similar questions. 我已经在网上搜索了可能的解决方案,包括Enthought Canopy的支持论坛,但未能按照其他类似问题下的说明解决我的问题。

I use Mac OS, and wanted to install external python packages to my Enthought Canopy (specifically, a new package named "ggplot" ( https://github.com/yhat/ggplot/ )). 我使用Mac OS,并想将外部python软件包安装到我的Enthought Canopy中(特别是一个名为“ ggplot”的新软件包( https://github.com/yhat/ggplot/ ))。

The instructions on the support forum of Enthought ( https://support.enthought.com/entries/23389761-Installing-packages-into-Canopy-Python-from-the-command-line ) said " follow standard Python installation procedures from the OS command line ". Enthought支持论坛( https://support.enthought.com/entries/23389761-Installing-packages-into-Canopy-Python-from-the-command-line )上的说明说:“请遵循操作系统命令行”。 However, I could only install this package to my previous python library (system default python). 但是,我只能将此软件包安装到以前的python库(系统默认python)中。 When I want to import this module in Canopy, it failed. 当我想在Canopy中导入该模块时,它失败了。 I thought I might need to change the installation path in order to install this package in Canopy, but not sure how to change and where to change. 我以为可能需要更改安装路径才能在Canopy中安装此软件包,但不确定如何更改以及在何处更改。

When I want to use Sublime text to run my scripts when I set Enthought as default python env, it succeeded so I guess it still imported the package from my previous python library. 将Enthought设置为默认python env时,当我想使用Sublime文本运行脚本时,它成功了,所以我猜它仍然从我以前的python库中导入了该包。 How can I know which environment the editor is currently using? 我怎么知道编辑器当前使用的环境?

Thanks! 谢谢!

1) The cited article links to another article , which describes how to make Canopy Python be the default python, and states that the easiest way is simply to use the Canopy Preferences dialog to make Canopy be your default Python. 1)引用的文章链接到另一篇文章 ,该文章描述了如何使Canopy Python成为默认python,并指出最简单的方法就是使用Canopy Preferences对话框使Canopy成为默认Python。

If you prefer not to do that, the article suggests that you modify the PATH environment variable (note that this is not actually an "installation path" but a more general path used for locating programs to run for any reason.) 如果您不愿意这样做,则本文建议您修改PATH环境变量(请注意,这实际上不是“安装路径”,而是用于定位出于任何原因运行的程序的更通用的路径。)

So I'm guessing that you don't know how to do this? 所以我猜你不知道该怎么做? Here's a simple way. 这是一个简单的方法。 From a terminal, type the following (substituting your own user name) before continuing with the installation: 在继续安装之前,从终端中键入以下内容(替换您自己的用户名):

export PATH=/Users/your-user-name/Library/Enthought/Canopy_64bit/User/bin:${PATH}

2) To find out what environment your editor is using, run the following program: 2)要找出您的编辑器正在使用什么环境,请运行以下程序:

import sys
print sys.prefix

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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