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 outhtml

During handling of the above exception, another exception occurred:python

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.
我與老師對什麼是環境裝好了產生了分歧。如今我認同老師。庫沒裝完,就是沒裝好環境。腳本很差使。git

相關文章
相關標籤/搜索