1
當我運行一個新的(沒有任何修改的新鮮創建)Flask Web Project在Visual Studio中不能編譯。我收到一個錯誤「No module named flask」。這對我來說毫無意義,因爲它是我創建的一個「Flask」項目,我沒有做任何事情來打破它。微軟是否可能爲新的Flask項目提供了不完整的模板?我很困惑。在Microsoft Visual Studio 2013中沒有名爲flask的模塊
當我嘗試添加一個虛擬的環境中,我得到以下日誌:
Value cannot be null.
Parameter name: valueInstalling 'pip' package manager.
Downloading setuptools from https://go.microsoft.com/fwlink/?LinkId=317603
Traceback (most recent call last):
File "E:\Microsoft Visual Studio 12.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.1\pip_downloader.py", line 47, in <module>
setuptools_package, _ = urlretrieve(SETUPTOOLS_SOURCE, 'setuptools.tar.gz')
File "C:\Python27\lib\urllib.py", line 94, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
File "C:\Python27\lib\urllib.py", line 240, in retrieve
fp = self.open(url, data)
File "C:\Python27\lib\urllib.py", line 208, in open
return getattr(self, name)(url)
File "C:\Python27\lib\urllib.py", line 437, in open_https
h.endheaders(data)
File "C:\Python27\lib\httplib.py", line 991, in endheaders
self._send_output(message_body)
File "C:\Python27\lib\httplib.py", line 844, in _send_output
self.send(msg)
File "C:\Python27\lib\httplib.py", line 806, in send
self.connect()
File "C:\Python27\lib\httplib.py", line 1198, in connect
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
File "C:\Python27\lib\ssl.py", line 392, in wrap_socket
ciphers=ciphers)
File "C:\Python27\lib\ssl.py", line 148, in __init__
self.do_handshake()
File "C:\Python27\lib\ssl.py", line 310, in do_handshake
self._sslobj.do_handshake()
IOError: [Errno socket error] [Errno 8] _ssl.c:510: EOF occurred in violation of protocol
'pip' failed to install. Exit code: 1
C:\Python27\python.exe: No module named pip
的「瓶項目」使用PowerShell可能只是創建一些目錄/文件的模板,您仍然必須創建virtualenv並安裝要使用的庫(包括Flask)。 – davidism 2014-10-29 06:07:10
請看微軟的[本指南](https://pytools.codeplex.com/wikipage?title=Flask)。 – dirn 2014-10-29 12:12:36
謝謝@dim。我嘗試添加一個虛擬環境,但它不工作,我在其他線程上看到了一些「不」使用它的評論。我不清楚任何一種選擇的全部影響,所以我現在編輯我的帖子來添加添加虛擬環境的日誌結果。最明顯的結論是pip沒有正確安裝,但是,我試圖依靠MSVS來照顧所有這些,因爲我對Python沒有經驗。有什麼建議麼? – DSMagic 2014-10-29 23:36:25