问题描述
我使用正式的dmg文件在我的MacOS X(10.6.8)上安装了spyderlib.同时,我从终端(即opencv,gdal ...)同时使用pip和homebrew安装了软件包.由于Spyder使用其自己的python版本,因此我无法在Spyder中访问我的外部软件包.
Homebrew安装软件包时,将其安装在/usr/local/lib ...目录中,该目录无法使用Spyder的Python路径管理器添加.整个目录/usr/...是隐藏的
我在网上发现的唯一相关的类似案例如下:向Spyder(Python IDE)添加模块(特别是pymorph)
我尝试了他们的建议,但没有成功.因此,有两个相关的问题可以解决这个问题:
1-是否可以在Spyder中实际使用与在终端中访问的Python相同的python?
2-否则,当将软件包安装在文件夹/usr/local ...中时,如何将外部软件包添加到Spyder的原始python中?
谢谢
我不使用Mac,但我会选择选项1,在常规Python上构建和安装Spyder.如果没有,请安装PyQt4:brew install pyqt
然后从此处下载 Spyder 2.2.5源(spyder-2.2.5.zip),将文件夹解压缩到你喜欢.然后打开一个终端,进入Spyder源文件夹(您必须从该文件夹内输入以下命令).然后使用您的常规python可执行文件进行构建:python setup.py build
并安装:python setup.py install
如果满足所有依赖关系,则应在主Python安装下将Spyder作为软件包.在Scripts文件夹下应该有一个脚本来执行它.
您还可以在 Spyder安装页面上看到直接从源代码安装或运行".
I have spyderlib installed on my MacOS X (10.6.8) using the official dmg file. In parallel, I have installed packages using both pip and homebrew from the terminal (i.e. opencv, gdal...). As Spyder is using its own python version, I cannot access my external packages within Spyder.
When Homebrew install a package, it instals it in the /usr/local/lib... directory, which is not avalaible to add using the Python Path manager of Spyder.The entire directory /usr/... is hidden.
The only relevant similar case I found online was the following:Adding a module (Specifically pymorph) to Spyder (Python IDE)
I have tried unsuccessfuly their recommendations. So two related questions to tackle the problem:
1- would it be possible to actually use in Spyder the same python as the one accessed in the terminal?
2- otherwise, how to add external packages to the Spyder's original python, when the packages are installed in the folder /usr/local... ?
Thanks
I don't use a mac, but I would go with option 1, building and installing Spyder on your regular Python.Install PyQt4 if you don't have it:brew install pyqt
Then download the Spyder 2.2.5 source (spyder-2.2.5.zip) from here, unzip the folder where you like.Then open a terminal, and go inside the Spyder source folder (you must input the next commands from inside this folder).Then build using your regular python executable:python setup.py build
and install:python setup.py install
If all dependencies are met, you should then have Spyder as a package under your main Python installation. There should be a script to execute it under the Scripts folder.
You can also see "Install or run directly from source" from the main Spyder installation page.
这篇关于如何在MacOS X上让spyder的python识别外部软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!