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:
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 torch
this 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.
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.
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!
Finally not reported red it!
END