Step records for Python beginners to install some software packages

1. View the installed virtual environment

conda env list

or

conda info --envs

2. Update pip

insert image description here
Update pip:

python -m pip install --upgrade pip

3. scikit-learn

Before the official installation sklearn, two libraries need to be installed, namely numpy+mkland scipy.

If you have installed numpy before, you need to uninstall the originally installed numpy.

numpy+mkland scipythird-party libraries: https://www.lfd.uci.edu/~gohlke/pythonlibs/

Just choose the version corresponding to your own environment to download, cp36that is , python=3.664 -bit.win_amd64win

insert image description here
After downloading, put these two packages in the Scripts directory of python installation.
It can be used where pythonto check the installation directory of python:
insert image description here
when installing, first locate the workspace in the terminal to the directory where we put the installation package, and then install it.
insert image description here

scikit-learnIt 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-smior nvcc -V.
insert image description here
insert image description here
Referring to this article , nvidia-smithe cuda version corresponding to the driver api is displayed, and nvcc -Vthe 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-smithe displayed version is greater than nvcc -Vthe version, usually there is no problem, and nvcc -Vthe 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)
insert image description 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.
insert image description here
cd into the directory where torch.whl is placed, then pip install
insert image description here

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
insert image description here
Similarly, cd into the directory where the torchvision.whl file is placed, and then pip install
insert image description here


to check whether the installation is successful:
insert image description here

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)
insert image description here


5. captured

Reference: https://github.com/pytorch/captum

pip install captum

or

conda install captum -c pytorch

6. An error occurred in nltk.download()

reference article

7. ltp

ltp installation failed, refer to the article

Supongo que te gusta

Origin blog.csdn.net/qq_42757191/article/details/128024591
Recomendado
Clasificación