Last answered:

04 Mar 2022

Posted on:

23 Feb 2022

1

Can't even get started in Visual Studio.

I have written the first 3 lines of code in this video in a file called "capstone_solution.py".

capstone_solution.py
import numpy as np
import cv2

I am already stuck. It says capstone_solution is not defined. I have saved the file, though. What should I do?image

3 answers ( 0 marked as helpful)
Instructor
Posted on:

23 Feb 2022

0

Hey Matt,

Delete the line

capstone_solution.py

You don't need it :) The lines of code are numbered 1, 2, 3, etc, so the code begins with importing the numpy library.

Kind regards,
365 Hristina

Posted on:

03 Mar 2022

0

Unfortunately, I can't even figure that out.
I think I installed cv2, but I don't even know that for sure because Python is not recognizing numpy. Please help.
image

Instructor
Posted on:

04 Mar 2022

0

Hey Matt,

I believe you have performed the steps for creating a new python environment, but let me outline them again.

First, type

conda create -n capstone

which creates a new environment called capstone. You will be asked to press y to proceed. Next, type

activate capstone

which will activate the capstone environment. If you then write

conda env list

you will get a list of all environments and a star will indicate the one you are currently in.

After activating the capstone environment, write

conda install -c conda-forge opencv

You would again need to press y to proceed. After the installation is complete (it may take a minute or two), type

conda list

The output should be as follows:
image.png
You see that both opencv and numpy have been installed.

Now, go to Visual Studio and make sure that you are working withing the capstone environment, where both numpy and opencv are installed. If you are opening Visual Studio from the Anaconda Navigator, then make sure that you have chosen capstone from the drop-down menu (in Giles' case, the environment is called vision).
image.png
If not, then please, follow the instructions on the following link.

I hope this helps! In case you run into a problem, don't hesitate to share it!

Kind regards,
365 Hristina

Submit an answer