为 Sublime Text 3 安装 numpy [英] Installing numpy for Sublime Text 3

查看:27
本文介绍了为 Sublime Text 3 安装 numpy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Ubuntu 14.04 上使用 Sublime Text 3,我只是在为 Sublime 中的包管理做准备.我遇到了这个插件 Advanced CSV 并通过包控制安装它,但它说它需要 numPy 库安装在包文件夹中".现在我对这意味着什么有点困惑,我发现了许多类似的问题,但这是关于插件开发的,因此我并没有真正理解它们.

I'm using Sublime Text 3 on Ubuntu 14.04, and I'm just warming up to Package Management in Sublime. I came across this plugin Advanced CSV and installed it via Package Control but it says it requires the numPy library installed "in the packages folder". Now I'm a little confused as to what that means and I've found a number of similar questions but it was with respect to plugin development hence I didn't really understand them.

我的问题是,在将文件夹 numpy-1.11.0 解压到 /home/{username}/.config 后,我是否通过标准安装 Python 库(例如 numPy)来实现此目的/sublime-text-3/Packages/ 还是其他一些关于构建或添加依赖项到配置文件的技术?

My question is do I achieve this by a standard installation of a Python library such as numPy after extracting the folder numpy-1.11.0 to /home/{username}/.config/sublime-text-3/Packages/ or is it some other technique with respect to building or adding the dependency to a config file ?

推荐答案

Julien Salinas 的 answer 涵盖了一些广泛的笔画,但不是正确的细节.你不能只下载 numpy-1.11.0.tar.gz 从 PyPI 中提取出来到 Packages/numpy.它需要通过运行 setup.py 来构建,而令人讨厌的是它需要使用 Python 3.3 来构建,您可能已经或可能没有安装在您的系统上.原因是 3.3 是 ST3 内部使用的 Python 版本,并且由于插件运行(在大多数情况下)使用 Sublime 的解释器,任何编译的模块都需要使用该解释器的相同 Major.minor 版本(major.minor 版本)构建.次要.微型版本应该没有区别).

Julien Salinas' answer covers some of the broad strokes, but not the correct details. You can't just download numpy-1.11.0.tar.gz from PyPI and extract it into Packages/numpy. It needs to be built by running setup.py, and the annoying thing is that it needs to be built using Python 3.3, which you may or may not have already installed on your system. The reason for this is 3.3 is the version of Python that ST3 uses internally, and since plugins run (in most cases) using Sublime's interpreter, any compiled modules need to be built with the same major.minor version of that interpreter (the major.minor.micro version shouldn't make a difference).

假设你没有,你必须下载 Python-3.3.6.tgz(MD5 校验和 here) 来自 python.org 并自己构建.如果您习惯于在 Linux 上从源代码构建程序,这相当简单,但是为了构建所有模块(它会在 make 的末尾说运行哪些模块不是构建)您很可能需要安装一些外部库.

Assuming you don't, you'll have to download Python-3.3.6.tgz (MD5 checksum here) from python.org and build it yourself. This is fairly straightforward if you're used to building programs from source on Linux, but in order to get all the modules built (it'll say at the end of the make run what modules weren't built) you'll most likely need to install some external libraries.

一旦您构建并安装了 3.3.6(我建议使用自定义位置,因此它不会干扰 Python 的系统版本),将 numpy 存档解压缩到自定义位置并使用setup.py 使用 Python 3.3.6.同样,您可能需要一些外部库才能成功构建它.构建完成后,将其安装到 Python 3.3.6 的 site-packages 目录,然后最后您可以从 site 复制 numpy 文件夹-packages~/.config/sublime-text-3/Packages.请注意大小写(或缺少大小写) - 最终目录应该是 Packages/numpy,而不是另一个答案中所示的 Packages/Numpy.正确安装后,重新启动 Sublime,高级 CSV 插件应该按预期运行.

Once you get 3.3.6 built and installed (I'd recommend a custom location so there's no chance of it interfering with the system version(s) of Python), extract the numpy archive to a custom location and build it with setup.py using Python 3.3.6. Again, you may need some external libraries to successfully build it. Once it's built, install it to Python 3.3.6's site-packages directory, then finally you can copy the numpy folder from site-packages to ~/.config/sublime-text-3/Packages. Note the capitalization (or lack thereof) - the final directory should be Packages/numpy, not Packages/Numpy as indicated in the other answer. Once properly installed, restart Sublime and the Advanced CSV plugin should function as expected.

祝你好运!

这篇关于为 Sublime Text 3 安装 numpy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆