简体   繁体   English

如何使用Python 3.5在Windows 10系统上安装mbed CLI?

[英]How to install mbed CLI on a Windows 10 system with Python 3.5?

I would like to install the ARM mbed CLI on my PC. 我想在我的电脑上安装ARM mbed CLI。 I follow this tutorial from the official website: 我从官方网站上关注本教程:
https://docs.mbed.com/docs/mbed-os-handbook/en/5.1/dev_tools/cli/ https://docs.mbed.com/docs/mbed-os-handbook/en/5.1/dev_tools/cli/
One of the prerequisites is having Python installed on the system. 其中一个先决条件是在系统上安装Python。 The tutorial mentions: 教程提到:

Python - mbed CLI is a Python script, so you'll need Python in order to use it. Python - mbed CLI是一个Python脚本,因此您需要使用Python才能使用它。 mbed CLI was tested with version 2.7.9 of Python. mbed CLI使用Python 2.7.9版进行了测试。 You can download that or a newer version here. 您可以在此处下载该版本或更新版本。

I do have Python installed, but not the 2.7 version. 我安装了Python,但不是2.7版本。 I have Python 3.5.2 :: Anaconda 4.2.0 (64-bit) instead. 我有Python 3.5.2 :: Anaconda 4.2.0 (64-bit)
The next prerequisite is having Git and Mercurial installed. 下一个先决条件是安装GitMercurial The tutorial mentions: 教程提到:

Git and Mercurial - mbed CLI supports both Git and Mercurial repositories, so you'll need to install both. Git和Mercurial - mbed CLI支持Git和Mercurial存储库,因此您需要同时安装它们。 Note: The directories of Git and Mercurial executables (git and hg) need to be in your system's PATH. 注意:Git和Mercurial可执行文件(git和hg)的目录需要在系统的PATH中。

I installed both: 我安装了两个:

> git --version
git version 2.10.2.windows.1

> hg --version
Mercurial Distributed SCM (version 4.0)

I install mbed CLI like this: 我像这样安装mbed CLI:

> pip install mbed-cli
Collecting mbed-cli
Installing collected packages: mbed-cli
Successfully installed mbed-cli-0.9.10

But it turns out that the installation is not good. 但事实证明安装并不好。 The windows command line doesn't recognize mbed commands: Windows命令行无法识别mbed命令:

> mbed --help
Traceback (most recent call last):
  File "c:\anaconda3\lib\runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Anaconda3\Scripts\mbed.exe\__main__.py", line 5, in <module>
  File "c:\anaconda3\lib\site-packages\mbed\mbed.py", line 989
    sorted_scms = sorted(sorted_scms, key=lambda (m, _): not m)
                                                 ^
SyntaxError: invalid syntax

I suspect that the Python 3.5 version is to blame (perhaps it would work with Python 2.7, I don't know). 我怀疑Python 3.5版本应该受到指责(也许它适用于Python 2.7,我不知道)。 Is there a way to make it work with Python 3.5? 有没有办法让它与Python 3.5一起使用? PS: I don't like to install Python 2.7 side-by-side with my existing Python 3.5. PS:我不喜欢与我现有的Python 3.5并排安装Python 2.7。 That's too much hassle. 这太麻烦了。

mbed CLI requires python 2.7.* . mbed CLI需要python 2.7。*。 Python 3.* is not supported yet. Python 3. *尚不支持。

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

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