当我们跑别人在github上的代码时,往往需要配置跟作者一样的环境。当作者导出自己的环境配置时,一般都是.yml文件,这时候需要输入命令行来实现配置一模一样的环境。
导出的yml文件一般配置如下:
name: vin_old_tf
channels:
- anaconda
- intel
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- _tflow_select=2.1.0=gpu
- absl-py=0.8.1=py37_0
- astor=0.8.0=py37_0
- attrs=19.3.0=py_0
- backcall=0.1.0=py37_0
- binutils_impl_linux-64=2.31.1=h6176602_1
- binutils_linux-64=2.31.1=h6176602_9
- blas=2.14=openblas
- bleach=3.1.0=py37_0
- bzip2=1.0.8=h7b6447c_0
- c-ares=1.15.0=h7b6447c_1001
- ca-certificates=2020.7.22=0
- cairo=1.16.0=hfb77d84_1002
- certifi=2020.6.20=py37_0
- cloudpickle=1.2.2=py_1
- coloredlogs=14.0=py37hc8dfbb8_1
- cudatoolkit=10.0.130=0
- cudnn=7.6.5=cuda10.0_0
- cupti=10.0.130=0
- cycler=0.10.0=py_2
- cytoolz=0.10.1=py37h516909a_0
- dask-core=2.9.2=py_0
- dbus=1.13.12=h746ee38_0
- decorator=4.4.1=py_0
- defusedxml=0.6.0=py_0
- entrypoints=0.3=py37_0
- expat=2.2.9=he1b5a44_2
- ffmpeg=4.1.3=h167e202_0
- fontconfig=2.13.1=h86ecdb6_1001
- freetype=2.9.1=h8a8886c_1
- gast=0.3.2=py_0
- gcc_impl_linux-64=7.3.0=habb00fd_1
- gcc_linux-64=7.3.0=h553295d_9
- giflib=5.2.1=h516909a_1
- glib=2.63.1=h5a9c865_0
- gmp=6.1.2=h6c8ec71_1
- gnutls=3.6.5=hd3a4fd2_1002
- google-pasta=0.1.8=py_0
- graphite2=1.3.13=h23475e2_0
- grpcio=1.16.1=py37hf8bcb03_1
- gst-plugins-base=1.14.5=h0935bb2_0
- gstreamer=1.14.5=h36ae1b5_0
- gxx_impl_linux-64=7.3.0=hdf63c60_1
- gxx_linux-64=7.3.0=h553295d_9
- h5py=2.10.0=nompi_py37h513d04c_101
- harfbuzz=2.4.0=h9f30f68_3
- hdf5=1.10.5=nompi_h3c11f04_1104
- humanfriendly=8.2=py37hc8dfbb8_0
- icu=64.2=he1b5a44_1
- imageio=2.6.1=py37_0
- imbalanced-learn=0.6.2=py_0
- importlib_metadata=1.3.0=py37_0
- intelpython=2020.0=1
- ipykernel=5.1.3=py37h39e3cac_1
- ipython=7.11.1=py37h39e3cac_0
- ipython_genutils=0.2.0=py37_0
- ipywidgets=7.5.1=py_0
- jasper=1.900.1=hd497a04_4
- jedi=0.15.2=py37_0
- jinja2=2.10.3=py_0
- joblib=0.13.2=py37_1
- jpeg=9c=h14c3975_1001
- jsonschema=3.2.0=py37_0
- jupyter=1.0.0=py37_7
- jupyter_client=5.3.4=py37_0
- jupyter_console=6.1.0=py_0
- jupyter_core=4.6.1=py37_0
- keras=2.3.1=py37_0
- keras-applications=1.0.8=py_0
- keras-preprocessing=1.1.0=py_1
- kiwisolver=1.1.0=py37hc9558a2_0
- lame=3.100=h7b6447c_0
- ld_impl_linux-64=2.33.1=h53a641e_7
- libblas=3.8.0=14_openblas
- libcblas=3.8.0=14_openblas
- libclang=9.0.1=default_hde54327_0
- libedit=3.1.20181209=hc058e9b_0
- libffi=3.2.1=hd88cf55_4
- libgcc-ng=9.1.0=hdf63c60_0
- libgfortran-ng=7.3.0=hdf63c60_0
- libgpuarray=0.7.6=h14c3975_1003
- libiconv=1.15=h63c8f33_5
- liblapack=3.8.0=14_openblas
- liblapacke=3.8.0=14_openblas
- libllvm9=9.0.1=hc9558a2_0
- libopenblas=0.3.7=h5ec1e0e_6
- libopencv=4.2.0=py37_2
- libpng=1.6.37=hbc83047_0
- libprotobuf=3.11.2=hd408876_0
- libsodium=1.0.16=h1bed415_0
- libstdcxx-ng=9.1.0=hdf63c60_0
- libtiff=4.1.0=h2733197_0
- libuuid=2.32.1=h14c3975_1000
- libwebp=1.0.2=h56121f0_5
- libxcb=1.13=h1bed415_1
- libxkbcommon=0.9.1=hebb1f50_0
- libxml2=2.9.9=hea5a465_1
- mako=1.1.0=py_0
- markdown=3.1.1=py37_0
- markupsafe=1.1.1=py37h7b6447c_0
- matplotlib=3.1.2=py37_1
- matplotlib-base=3.1.2=py37h250f245_1
- mistune=0.8.4=py37h7b6447c_0
- more-itertools=8.0.2=py_0
- nbconvert=5.6.1=py37_0
- nbformat=4.4.0=py37_0
- ncurses=6.1=he6710b0_1
- nettle=3.4.1=h1bed415_1002
- networkx=2.4=py_0
- notebook=6.0.2=py37_0
- nspr=4.24=he1b5a44_0
- nss=3.47=he751ad9_0
- numpy=1.16.4=py37h99e49ec_0
- numpy-base=1.16.4=py37h2f8d375_0
- olefile=0.46=py_0
- opencv=4.2.0=py37_2
- openh264=1.8.0=hd408876_0
- openssl=1.1.1g=h7b6447c_0
- pandas=1.0.3=py37h0573a6f_0
- pandoc=2.2.3.2=0
- pandocfilters=1.4.2=py37_1
- parso=0.5.2=py_0
- pcre=8.43=he6710b0_0
- pexpect=4.7.0=py37_0
- pickleshare=0.7.5=py37_0
- pillow=6.0.0=py37h34e0f95_0
- pip=19.3.1=py37_0
- pixman=0.38.0=h7b6447c_0
- prometheus_client=0.7.1=py_0
- prompt_toolkit=3.0.2=py_0
- protobuf=3.11.2=py37he6710b0_0
- ptyprocess=0.6.0=py37_0
- py-opencv=4.2.0=py37h5ca1d4c_2
- pygments=2.5.2=py_0
- pygpu=0.7.6=py37hc1659b7_1000
- pyparsing=2.4.6=py_0
- pyqt=5.12.3=py37h8685d9f_3
- pyrsistent=0.15.6=py37h7b6447c_0
- python=3.7.6=h0371630_2
- python-dateutil=2.8.1=py_0
- python_abi=3.7=1_cp37m
- pytz=2020.1=py_0
- pywavelets=1.1.1=py37hc1659b7_0
- pyyaml=5.3.1=py37h8f50634_0
- pyzmq=18.1.0=py37he6710b0_0
- qt=5.12.5=hd8c4c69_1
- qtconsole=4.6.0=py_1
- readline=7.0=h7b6447c_5
- scikit-image=0.16.2=py37hb3f55d8_0
- scikit-learn=0.22.1=py37h22eb022_0
- scipy=1.3.2=py37he2b7bc3_0
- send2trash=1.5.0=py37_0
- setuptools=44.0.0=py37_0
- six=1.13.0=py37_0
- sqlite=3.30.1=h7b6447c_0
- tensorboard=1.14.0=py37hf484d3e_0
- tensorflow=1.14.0=gpu_py37h4491b45_0
- tensorflow-base=1.14.0=gpu_py37h8d69cac_0
- tensorflow-estimator=1.14.0=py_0
- tensorflow-gpu=1.14.0=h0d30ee6_0
- termcolor=1.1.0=py37_1
- terminado=0.8.3=py37_0
- testpath=0.4.4=py_0
- theano=1.0.4=py37he1b5a44_1001
- tk=8.6.10=hed695b0_0
- toolz=0.10.0=py_0
- tornado=6.0.3=py37h7b6447c_0
- tqdm=4.41.1=py_0
- traitlets=4.3.3=py37_0
- ujson=2.0.3=py37he6710b0_0
- wcwidth=0.1.7=py37_0
- webencodings=0.5.1=py37_1
- werkzeug=0.16.0=py_0
- wheel=0.33.6=py37_0
- widgetsnbextension=3.5.1=py37_0
- wrapt=1.11.2=py37h7b6447c_0
- x264=1!152.20180806=h7b6447c_0
- xorg-kbproto=1.0.7=h14c3975_1002
- xorg-libice=1.0.10=h516909a_0
- xorg-libsm=1.2.3=h84519dc_1000
- xorg-libx11=1.6.9=h516909a_0
- xorg-libxext=1.3.4=h516909a_0
- xorg-libxrender=0.9.10=h516909a_1002
- xorg-renderproto=0.11.1=h14c3975_1002
- xorg-xextproto=7.3.0=h14c3975_1002
- xorg-xproto=7.0.31=h14c3975_1007
- xz=5.2.4=h14c3975_4
- yaml=0.2.5=h516909a_0
- zeromq=4.3.1=he6710b0_3
- zipp=0.6.0=py_0
- zlib=1.2.11=h7b6447c_3
- zstd=1.3.7=h0b5b093_0
- pip:
- dlib==19.19.0
- pyqt5-sip==4.19.18
- pyqtchart==5.12
- pyqtwebengine==5.12.1
prefix: /home/rubin/anaconda3/envs/vin_old_tf
如上述代码所示:name是创建虚拟环境之后在anaconda/envs文件夹下虚拟环境的名称,比如这个为:vin_old_tf;channels、dependents、pip都是需要下载的包名;prefix则是自己anaconda文件下虚拟环境的路径,
需要把这个路径改为自己的文件夹。
接下来配置和创建虚拟环境,输入如下命令行:
conda env create -f environment.yml
然后按enter,系统就开始自动下载啦,等一段时间之后就安装和配置成功了。
PS:看安装成功与否可以看/home/rubin/anaconda3/envs/文件夹下有没有创建的虚拟环境的文件名,有的话就是安装成功了。