Windows下Conda环境配置TensorFlow相关问题咨询
Hey there! Since you're new to Conda and working with TensorFlow on Windows, let's unpack each of your questions clearly:
1. Do I need to create the IntroToTensorFlow environment every time?
Absolutely not! Conda environments only need to be created once. You probably ran something like conda create -n IntroToTensorFlow tensorflow (plus any other packages you need) to set it up initially. After that, you just need to activate it whenever you want to use it—no need to recreate it over and over.
Also, quick note: the source activate command is for Linux/macOS systems. On Windows, you should use conda activate IntroToTensorFlow (for newer Conda versions) or just activate IntroToTensorFlow if you're on an older version.
2. Will the environment automatically deactivate when I close the Jupyter Notebook kernel?
Not exactly. Here's how it works:
- When you activate your
IntroToTensorFlowenvironment and installipykernel(then link it to Jupyter withpython -m ipykernel install --user --name IntroToTensorFlow --display-name "IntroToTensorFlow"), the Jupyter kernel you select runs code inside that environment. - Closing the Jupyter kernel stops your code from running, but it doesn't deactivate the Conda environment itself. The environment's active state is tied to your terminal session. If you still have the terminal window open where you activated the environment, it'll stay active until you run
conda deactivateor close the terminal.
3. Do I have to activate the environment every time after restarting my computer?
Yes, you do. When you restart your PC, all terminal sessions reset, and Conda will default back to the base environment (or your system's default Python if you haven't set up Conda to auto-activate). So every time you open a new terminal to work with TensorFlow, you'll need to run conda activate IntroToTensorFlow to switch into your target environment.
If you really want to skip this step every time, you can configure Conda to auto-activate your IntroToTensorFlow environment by default, but this isn't usually recommended—it's better to keep the base environment clean and only activate specific environments when you need them.
内容的提问来源于stack exchange,提问作者skoundin

