使用 Enthought Python 代替系统 Python

发布于 2024-12-29 03:32:56 字数 460 浏览 0 评论 0原文

我已经安装了 Enthought Python Distribution,它基本上是一个美化的 Python 发行版,添加了用于数值计算的库和科学计算。现在,由于我使用 Debian,所以已经安装了 Python。如果我希望使用 Enthought Python 来完成所有工作,我该怎么做?

现在我正在使用一个基本的别名,例如:

alias python='/usr/local/share/enthought/bin/python'

这很好,但是对于像 #! 这样的 shebang 指令会失败。独立 Python 脚本中的 /usr/bin/env python 。那么我如何让系统使用 Enthought Python(当然不破坏任何东西!)。谢谢!

I've installed the Enthought Python Distribution, which is basically a glorified Python distribution with added libraries for numerical and scientific computing. Now, since I use Debian, there is Python installed already. If I wish to use the Enthought Python for all work, how would I go about doing that?

Right now I am using a rudimentary alias like:

alias python='/usr/local/share/enthought/bin/python'

This is fine, but fails for shebang directives like #! /usr/bin/env python in independent Python scripts. So how do I get the system to use Enthought Python (without breaking anything of course!). Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

逆光飞翔i 2025-01-05 03:32:56

我认为这是官方的做法,正如 Enthought 所建议的:

export PATH=/usr/local/EPD/bin:$PATH

如果您安装到 /usr/local/EPD。否则,一般形式为

export PATH=/path/to/EPD/bin:$PATH 

这会将 EPD 二进制目录的路径添加到系统 PATH 变量中。 : 是某种连接符号。您可以每次在终端中运行它,也可以将其放入 ~/.bashrc 文件中。


重要编辑:

事实证明,EPD 实际上应该附加到 PATH 中,否则您可能会遇到操作系统问题。这样做:

 export PATH=$PATH:/path/to/EPD/bin

I think this is the official way of doing it, as recommended by Enthought:

export PATH=/usr/local/EPD/bin:$PATH

if you installed to /usr/local/EPD. Otherwise, the general form is

export PATH=/path/to/EPD/bin:$PATH 

This prepends the path to the EPD binary directory to your system PATH variable. The : is some sort of concatenate symbol. You can either run this in terminal every time, or you can put this in your ~/.bashrc file.


Critical Edit:

It turns out that EPD should actually be appended to the PATH, or you may have OS problems. Do it like this:

 export PATH=$PATH:/path/to/EPD/bin
爱冒险 2025-01-05 03:32:56

如果你使用 Debian,你可以在 virtualenv 中安装 Python。

Enthought 将拥有自己的库,而不会打扰其他需要系统版本的 debian 程序。您可以使用 virtualenvwrapper 更轻松地在环境之间进行切换。

还有一种使用 virtualenv 在环境之间共享(某些)站点包的方法。确保在 virtualenv 中使用 pip 而不是 easy_install。

姜戈人一直这样做。

If your on Debian you could install enthought Python in virtualenv.

Enthought would have its own libraries without bothering other debian programs that need the system version. You could make switching easier between environments with virtualenvwrapper.

There is also a method with virtualenv to share (certain) site-packages among environments. Make sure to use pip instead of easy_install within a virtualenv.

Django people do it all the time.

等风也等你 2025-01-05 03:32:56

将当前版本的 python 符号链接到 Enthought 版本。

ln -s /usr/bin/python[version]  /path/to/enthought/python

Symlink the current version of python to the Enthought one.

ln -s /usr/bin/python[version]  /path/to/enthought/python
锦爱 2025-01-05 03:32:56

我认为,在 Debian 上最好安装这样的软件包:

apt-get install python-numpy python-numpy-doc python-scipy python-matplotlib ipython

而不是安装 Enthought Python Distribution。

I think, that on Debian it is better to install packages like this:

apt-get install python-numpy python-numpy-doc python-scipy python-matplotlib ipython

instead of install Enthought Python Distribution.

我ぃ本無心為│何有愛 2025-01-05 03:32:56

嗯我也遇到这个问题了。我做的第一件事是建议按照 Chad 的建议将 python 添加到路径中,但这会导致其他 Linux 应用程序出现一些问题,这些应用程序使用的库未包含在 Enthought 中,但包含在 Linux Mint(或您的任何发行版)中。重新使用)。特别是,如果我从终端加载 python,我成功输入 Enthought 版本的 python,但运行“import pygtk”会导致错误(因为该库未安装在 Enthought 版本的 python 中)。

有谁知道如何使用 PYTHONPATH 首先包含 Enthought 库,然后包含标准 Linux 库?这将是最佳配置......

Hmm I'm also encountering this problem. The first thing I did was the suggestion to prepend python to the path as suggested by Chad, but this results in some problems for other linux apps that use libraries that are not included in Enthought but are included in Linux Mint (or whatever distro you're using). In particular, if I load python from terminal, I successfully enter Enthought's version of python, but running "import pygtk" results in an error (because the library isn't installed in the Enthought version of python).

Does anyone know how to use PYTHONPATH to include first Enthought libraries, and then include the standard Linux libraries? This would be the optimal configuration....

风吹短裙飘 2025-01-05 03:32:56

我使用别名。

alias python=~/Softwares/EPD_7.3/epd-7.3-2-rh5-x86_64/bin/python
alias ipython=~/Softwares/EPD_7.3/epd-7.3-2-rh5-x86_64/bin/ipython

I use aliases.

alias python=~/Softwares/EPD_7.3/epd-7.3-2-rh5-x86_64/bin/python
alias ipython=~/Softwares/EPD_7.3/epd-7.3-2-rh5-x86_64/bin/ipython
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文