简体   繁体   English

在Mac上安装适用于python3的spyder

[英]Installing spyder for python3 on mac

I am very frustrated. 我很沮丧。 It seems I don't understand a very basic concept of this installing and can't find an answer. 看来我不了解此安装的基本概念,也找不到答案。

As the title says I want to install spyder for python3 on my mac. 如标题所示,我想在Mac上安装适用于python3的spyder。 Since I couldn't find any easy installation just by clicking some where. 由于我仅单击某些位置就找不到任何简单的安装。

On mac python 2.7 is preinstalled and I already installed python3 which was pretty easy. 在Mac上预装了python 2.7,我已经安装了python3,这非常简单。

So I started by installing pip by typing sudo easy_install pip in the command line. 因此,我首先在命令行中输入sudo easy_install pip来安装pip Then I followed the introduction of this site which basically says to type pip install -U spyder which led to an error at the end. 然后,我跟随该站点的介绍, 该站点基本上说要键入pip install -U spyder ,最后导致错误。 I realized that I have to use pip3 because I have two python versions. 我意识到我必须使用pip3因为我有两个python版本。 Why is this nowhere mentioned?! 为什么这里没有提到? Anyway this worked -- at least it didn't trigger an error. 无论如何,这行之有效-至少它没有触发错误。 However, now I am confused where is the application? 但是,现在我很困惑,应用程序在哪里? How can I use spyder now? 我现在如何使用spyder?

Any help is appreciated. 任何帮助表示赞赏。

edit As I changed into to folder bin suddenly the terminal responded to spyder3 But the result was 编辑当我突然变成文件夹bin时,终端响应了spyder3但结果是

Nathanaels-iMac:bin nathanaelskrepek$ spyder3 
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/qtpy/__init__.py", line 148, in <module>
    from PySide import __version__ as PYSIDE_VERSION  # analysis:ignore
ModuleNotFoundError: No module named 'PySide'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/spyder3", line 11, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spyder/app/start.py", line 144, in main
    from spyder.app import mainwindow
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spyder/app/mainwindow.py", line 49, in <module>
    requirements.check_qt()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/spyder/requirements.py", line 39, in check_qt
    import qtpy
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/qtpy/__init__.py", line 154, in <module>
    raise PythonQtError('No Qt bindings could be found')
qtpy.PythonQtError: No Qt bindings could be found

Nathanael, 拿但业

It sounds as though you've done the right thing, but you've done something else too. 听起来好像您做对了事情,但您也做了其他事情。

pip3 install spyder # Installs Spyder for python 3

If you want to know where the Spyder app is, use the which command. 如果您想知道Spyder应用程序在哪里,请使用which命令。

which spyder3 # This will give you the path to the application file.

If you want to use Spyder, enter spyder3 followed by the file you'd like to edit. 如果要使用Spyder,请输入spyder3,然后输入要编辑的文件。

spyder3 myfilename.py # Opens (creates if needed) myfilename.py in Spyder.

Depending on how deep your trouble is, you may want to just re-install Spyder, or you will likley want to clean up your python3 install with something like Homebrew on your mac. 根据问题的严重程度,您可能只想重新安装Spyder,或者您可能会想在Mac上使用Homebrew之类的工具清理python3安装。

As you'll read on Github , Anaconda recently stopped financially supporting Spyder and they list some alternate installation methods which you may want to use if you're not going to use Anaconda or PIP. 正如您在Github上阅读的那样,Anaconda最近停止了对Spyder的财务支持,并且列出了一些其他安装方法,如果您不打算使用Anaconda或PIP,可能要使用这些方法。

Best of luck! 祝你好运!

( Spyder developer here ) 这里是Spyder开发人员

So I started by installing pip by typing sudo easy_install pip in the command line. 因此,我首先在命令行中输入sudo easy_install pip来安装pip。

Please avoid this route entirely. 请完全避免使用此路线。 You should never, ever install things into your system Python (especially in macOS) because you can risk to break your system entirely. 永远不要将任何东西安装到系统Python中(尤其是在macOS中),因为您可能会冒险完全破坏系统。 That's because Python is used by the operating system to run certain things, so it's better to leave it alone. 那是因为操作系统使用Python运行某些东西,所以最好不要使用它。

The simplest way to install Spyder in macOS is to download Anaconda and install it. 在macOS中安装Spyder的最简单方法是下载Anaconda并安装它。 Anaconda comes with all Spyder dependencies and also with the most important scientific Python libraries ready to be used. Anaconda附带了所有Spyder依赖项,以及最重要的科学Python库可供使用。

Other options are Homebrew or MacPorts, but Anaconda is really the easiest one. 其他选项是Homebrew或MacPorts,但Anaconda确实是最简单的选项。

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

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