• VS code MacOS 环境搭建


    环境:MacBook Pro
    参考博客
    为了动手开发AI代码,我需要安装一个VS code。
    开始我以为是安装visual studio呢。我装过visual studio2017。
    VS code是一个文本编辑器,有一些插件。安装包只有几十兆大小。

    在官网下载VS code,点击扩展,搜索下载python插件和tools for AI,需要中文的同学可以下载中文语言包。下载好了会显示重新加载,点击重新加载,就装好了。
    下载安装git,我在桌面上建了个文件夹deeplearning。
    cd deeplearning
    git clone https://github.com/Microsoft/samples-for-ai/
    然后就把ai库克隆到本地了。
    我的python版本是3.7,安装失败,在原博下面评论得知需要安装3.5或3.6版本的python。3.7是新的测试的python,可能跟框架不兼容。3.5或3.6则肯定是好使的。
    在官网下python3.6.5,下了好几个小时都没下下来,总是断。我打了几个小时游戏。吃饭回来一刷新,再试一次吧。就下好了。要是还没装上,我就去找国内的镜像了。
    然后双击安装之类的操作都很常规。
    装好了之后进到
    samples-for-ai/installer
    目录,
    python3 install.py。
    由于mac自带python2,使用python3 指定使用python3来解释执行python代码.装完了提示有几个库没装上,安装成功。
    就算是装好了吧。

    截图是tensorflow下的minst示例。缺什么库,vscode会自己用pip命令下载下来。
    做实验待续。
    分割线
    GodlikeGakkideMacBook-Pro:installer godlikegakki$ python3 install.py
    20:33:28 [INFO] [Microsoft Visual Studio Tools for AI] Detecting system information ...
    20:33:28 [INFO] [Microsoft Visual Studio Tools for AI] OS: Darwin-17.6.0, 64bit
    20:33:28 [INFO] [Microsoft Visual Studio Tools for AI] Python: 3.6.5, 64bit
    20:33:28 [INFO] [Microsoft Visual Studio Tools for AI] NVIDIA GPU: None
    20:33:28 [INFO] [Microsoft Visual Studio Tools for AI] Git: True
    20:33:28 [INFO] [Microsoft Visual Studio Tools for AI] Begin to install scipy(numpy, scipy) ...
    20:33:28 [INFO] [Microsoft Visual Studio Tools for AI] Begin to pip-install numpy 1.14.3 ...
    20:33:28 [INFO] [Microsoft Visual Studio Tools for AI] Begin to install CNTK(BrainScript) ...
    20:33:28 [WARNING] [Microsoft Visual Studio Tools for AI] CNTK(BrainScript) is not supported on your OS, we recommend 64-bit Windows-10 OS or 64-bit Linux OS.
    Exception:
    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 302, in _error_catcher
    yield
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 384, in read
    data = self._fp.read(amt)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 60, in read
    data = self.__fp.read(amt)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 449, in read
    n = self.readinto(b)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 493, in readinto
    n = self.fp.readinto(b)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
    socket.timeout: The read operation timed out

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/commands/install.py", line 324, in run
    requirement_set.prepare_files(finder)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/req/req_set.py", line 620, in _prepare_file
    session=self.session, hashes=hashes)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/download.py", line 821, in unpack_url
    hashes=hashes
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/download.py", line 659, in unpack_http_url
    hashes)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/download.py", line 882, in _download_http_url
    _download_url(resp, link, content_file, hashes)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/download.py", line 603, in _download_url
    hashes.check_against_chunks(downloaded_chunks)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/utils/hashes.py", line 46, in check_against_chunks
    for chunk in chunks:
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/download.py", line 571, in written_chunks
    for chunk in chunks:
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/download.py", line 560, in resp_read
    decode_content=False):
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 436, in stream
    data = self.read(amt=amt, decode_content=decode_content)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 401, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line 99, in exit
    self.gen.throw(type, value, traceback)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip/_vendor/urllib3/response.py", line 307, in _error_catcher
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
    pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
    20:39:33 [ERROR] [Microsoft Visual Studio Tools for AI] Fail to pip-install numpy, unexpected error! Please try to run installer script again!
    20:39:33 [ERROR] [Microsoft Visual Studio Tools for AI] Pip_install_scipy terminated due to numpy installation failure.
    20:39:33 [INFO] [Microsoft Visual Studio Tools for AI] Fail to install numpy 1.14.3. Please try to run installer script again!
    20:39:33 [INFO] [Microsoft Visual Studio Tools for AI] Setup finishes.
    Press enter to exit.
    我与老师对什么是环境装好了产生了分歧。现在我认同老师。库没装完,就是没装好环境。脚本不好使。

  • 相关阅读:
    WebStorm2020.3.0及以下安装激活方法
    CSS随堂笔记【狂神说JAVA】
    HTML随堂笔记【狂神说JAVA】
    JAVA语言基础随堂笔记
    js 常用类和方法
    js 数组
    js 对象和函数
    js 基础语法
    JavaScript 简介
    PS基础
  • 原文地址:https://www.cnblogs.com/gaoyb348/p/9179457.html
Copyright © 2020-2023  润新知