Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

Add CNTK virtualenv to Visual Studio Python project

I followed Setup CNTK on Windows, and confirmed that I can run CTNK from my local command prompt.

C:localAnaconda3-4.1.1-Windows-x86_64envscntk-py34>.Scriptsactivate.bat
(root) C:localAnaconda3-4.1.1-Windows-x86_64envscntk-py34>set PATH=C:localCNTK-2-0-beta3-0-Windows-64bit-CPU-Onlycntkcntk;%PATH%
(root) C:localAnaconda3-4.1.1-Windows-x86_64envscntk-py34>python -i
Python 3.4.4 |Continuum Analytics, Inc.| (default, Jun 15 2016, 15:25:08) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from cntk import Trainer
>>>

I want to use Python Tools Visual Studio, so I tried to add this virtualenv to a new Python project by "Add Existing Virtual Environment...", but I got this following error.

We could not identify a virtual environment in the selected path.

Adding another existing virtualenv worked fine. I appreciate your help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Here the steps that I use for existing conda env from Visual Studio:

  1. Create your Anaconda environment as mentioned in the setup instruction (you already done that).
  2. In VS, from View->Other Windows select “Python Environments”. a. Add a custom environment, and fill all the fields from your Anaconda environment path, yours is: "C:localAnaconda3-4.1.1-Windows-x86_64envscntk-py34" b. Make sure that the version is 3.4 and Architecture is x64. c. Then click Apply, Apply will take long to complete, there will be an inline progress bar wait for it to finish.
  3. In the solution explorer, under your python project: a. Right click on “Python Environments” and select “AddRemove Python Environments”. b. Select the custom environment that you added in (2)
  4. Close Visual Studio, and activate the Anaconda environments that you created in (1). a. From this environment type (the path to your VS x64 native environment): "C:Program Files (x86)Microsoft Visual Studio 12.0VCvcvarsall.bat" amd64 b. Launch Visual Studio from this environment by typing “devenv.exe”.

Step (4) is crucial, or Visual Studio won't find CNTK dependency DLLs.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...