I am using anaconda python. So every time, in my mac terminal, I input the terminal command:
source /Users/mylaptop/anaconda/bin/activate /Users/mylaptop/anaconda
And then I activated the anaconda python environment. But I don't want to write this command line every time, so I tried a bash script like this:
#! /bin/bash
source /Users/mylaptop/anaconda/bin/activate /Users/mylaptop/anaconda
and I put this file in the directory /usr/local/bin
. But unfortunately, I cannot log into anaconda environment in this way. There is no error message showed up in the terminal. So I do not know what is happening here.
Could anyone help me out?
Starting NavigatorFrom the Start menu, search for “Anaconda Navigator” and click to open. Or from the Start menu, search for “Anaconda Prompt” and click to open. In Anaconda Prompt, type in anaconda-navigator and press Enter to open Navigator.
Windows: You'll find Anaconda Navigator in the Start menu. Linux: Open a terminal window and run the command anaconda-navigator .
Click Start�All Programs�Anaconda (64-bit)�Anaconda Command Prompt. � A command prompt window will open. Type idle to run the Python interpreter. A new window titled Python Shell will open and you will see the Python >>> command prompt.
You can manually specify the path to the conda executable to use for activation (version 4.4+). To do so, open the Command Palette (Ctrl+Shift+P) and enter Preferences: Open User Settings. Then set python.condaPath , which is in the Python extension section of User Settings, with the appropriate path.
The easiest fix is to just put /Users/mylaptop/anaconda
in your PATH, by adding something like
export PATH="/Users/mylaptop/anaconda:$PATH"
to your bash profile (~/.profile
).
You can't put the activate script in a script because it has to be "sourced" to work. source
causes the script to be run in your current shell (as opposed to a subshell, which is how the bash script you wrote is run). This is necessary because it modifies your PATH
environment variable, and environment variables from your current shell cannot be modified by subshells.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With