Solution to torch package download and installation failure

When I plan to use python's torch package today, I input it pip install torch, and the download in pycharm has been failing.

The error message indicates that the pip version was wrong at the beginning:

WARNING: You are using pip version 20.0.2, however version 20.2.3 is available.

Caused me to update pip all day, but to no avail! ! !

Later, the error message becomes:

Requirement already satisfied: torch in d:\programming\anaconda3\lib\site-packages

Turns out the problem was: Conflict between Python and anaconda

As shown in the picture:

insert image description here

Solution:

In cmd, use pip install --target=目标路径the command in the format of the toolkit name to install the required library.
For example, if you use pip install --target=d:/programming/Python37/Lib/site-packages torchthis command to install the torch library, you can install it successfully.

How to find this target path?
File–>Settings–>Python Interpreter, you can see that Python is installed in that path.
insert image description here
then in thisFolders of the Python installation directoryIn, (for example, here I am: Python38-32)
findlib directory,click to enter.
find againsite-packages directory, the path is found.

insert image description here

If the path is not downloaded at the beginning, it doesn't matter. find your downloadedLibrary filesandlibrary name + .dist-info file, copy these two files to the target path!

insert image description here

Finally not reported red it!
insert image description here

END

Guess you like

Origin blog.csdn.net/qq_51669241/article/details/127975083