Best actions
-
Using the environment
-
Command
- conda create -n py2 python=2
- conda create -n py3 python=3
- purpose: to create individual environment for Python 2 and Python 3
-
-
Sharing the environment
- When sharing the code on Github, you had better create the environment document at the same time, which is included in the libraries, so that others can install the dependencies of your code more easily.
More actions on the environment
-
Restore the environment
-
Command
- conda env export > environment.yaml
- It can save your packages as YAML document.
- conda env export --> It can output the name of all the packages in the environment.
environment.yaml -->It can write the outputed document into environment.yaml
- Sharing the environment is very useful because it enables others to install all the packages included in your code.
- To create the environment through environment files,you can use conda env
-
-
List the environment
-
Command
- conda env list
- list all the environment that you've created.
-
-
delete the environment
- #### Command - conda env remove -n env_name
Manage the Environment
-
Manage the environment
-
Command
- conda create -n env_name list of packages
- n refers to the name and 'list of packages' refers to the packages to be installed in the environment
-
-
enter the Environment
-
Command
- source activate my_env
- conda list -->packages
- source deactivate -->leave
-
the diffenrence between python2 & python3
-
Print
-
python2
print "Hello", "world"
-
python3
print("Hello","world")
- if you want to print info in both the two versions you can import 'print_function' in your code.
-