Table of contents
1. View the installed virtual environment
conda env list
or
conda info --envs
2. Update pip
Update pip:
python -m pip install --upgrade pip
3. scikit-learn
Before the official installation sklearn
, two libraries need to be installed, namely numpy+mkl
and scipy
.
If you have installed numpy before, you need to uninstall the originally installed numpy.
numpy+mkl
and scipy
third-party libraries: https://www.lfd.uci.edu/~gohlke/pythonlibs/
Just choose the version corresponding to your own environment to download, cp36
that is , python=3.6
64 -bit.win_amd64
win
After downloading, put these two packages in the Scripts directory of python installation.
It can be used where python
to check the installation directory of python:
when installing, first locate the workspace in the terminal to the directory where we put the installation package, and then install it.
scikit-learn
It can also be installed in the same way, too pip install -U scikit-learn
.
4. torch & torchvision
4.1 torch
(1) If the computer has a graphics card, you first need to check the cuda version on your computer, enter nvidia-smi
or nvcc -V
.
Referring to this article , nvidia-smi
the cuda version corresponding to the driver api is displayed, and nvcc -V
the cuda version corresponding to the runtime api is displayed. The version of the driver api can be backward compatible with the version of the runtime api, that is, nvidia-smi
the displayed version is greater than nvcc -V
the version, usually there is no problem, and nvcc -V
the displayed version shall prevail when installing torch.
(2) Enter the PyTorch official website , if you want to install an old version of torch, select install previous versions of PyTorch . (I installed torch1.5.1 here)
(3) Using (2) this way of installation may be too slow, you can go to the website to download torch first, and then install it.
URL: https://download.pytorch.org/whl/torch_stable.html
Download the version you need: mine is cuda10.2, windows operating system, python3.7.
cd into the directory where torch.whl is placed, then pip install
4.2 torchvision
Correspondence between torch and torchvision versions
Download the corresponding version of torchvision according to the torch version.
Still just the URL: https://download.pytorch.org/whl/torch_stable.html
Similarly, cd into the directory where the torchvision.whl file is placed, and then pip install
to check whether the installation is successful:
5. jupyter nodebook
5.1 How to use the virtual environment created by yourself in jupyter notebook?
Needs to be installed in its own virtual environment ipykernel
, it provides the IPython kernel for Jupyter:
pip install ipykernel
Then add the virtual environment to Jupyter by typing:
python -m ipykernel install --user --name=环境名
5.2 Add code auto-completion function for jupyter notebook
Download the extended plugin jupyter_contrib_nbextensions to complete the code:
pip install jupyter_contrib_nbextensions
Then open jupyter notebook (if you have opened it before, you need to restart Jupyter notebook)
5. captured
Reference: https://github.com/pytorch/captum
pip install captum
or
conda install captum -c pytorch
6. An error occurred in nltk.download()
7. ltp
ltp installation failed, refer to the article