简体   繁体   中英

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. I follow this tutorial from the official website:
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. The tutorial mentions:

mbed CLI is a Python script, so you'll need Python in order to use it. mbed CLI是一个Python脚本,因此您需要使用Python才能使用它。 mbed CLI was tested with version 2.7.9 of Python. You can download that or a newer version here.

I do have Python installed, but not the 2.7 version. I have Python 3.5.2 :: Anaconda 4.2.0 (64-bit) instead.
The next prerequisite is having and installed. The tutorial mentions:

mbed CLI supports both Git and Mercurial repositories, so you'll need to install both. mbed CLI支持Git和Mercurial存储库,因此您需要同时安装它们。 Note: The directories of Git and Mercurial executables (git and hg) need to be in your system's 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:

> 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:

> 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). Is there a way to make it work with Python 3.5? PS: I don't like to install Python 2.7 side-by-side with my existing Python 3.5. That's too much hassle.

mbed CLI requires python 2.7.* . Python 3.* is not supported yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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