pycharm控制台 输入代码下载pytorch cpu版本
pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pytorch gpu版本可以参考
python+pytorch快速安装_最生猛的开拓者的博客
或者是: 使用 requirements.txt
requirements.txt 内容 我当时的一个环境
absl-py==1.0.0
addict==2.4.0
aiohttp==3.8.1
aiosignal==1.2.0
annoy==1.17.0
anyio==3.5.0
anykeystore==0.2
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
astor==0.8.1
async-timeout==4.0.2
asynctest==0.13.0
attrs==21.4.0
Babel==2.9.1
backcall==0.2.0
bert4keras==0.10.5
bitarray==2.4.0
bleach==4.1.0
cached-property==1.5.2
cachetools==5.0.0
certifi==2021.10.8
cffi==1.15.0
charset-normalizer==2.0.12
click==8.0.4
cloudpickle==2.0.0
colorama==0.4.4
cryptacular==1.6.2
cycler==0.11.0
Cython==0.29.21
datasets==2.0.0
debugpy==1.5.1
decorator==5.1.1
defusedxml==0.7.1
dill==0.3.4
efficientnet-pytorch==0.7.1
entrypoints==0.4
fairscale==0.4.6
filelock==3.6.0
Flask==2.1.2
fonttools==4.29.1
frozenlist==1.3.0
fsspec==2022.2.0
gast==0.5.3
gensim==4.0.0
git-py==1.0.2
google-auth==2.6.0
google-auth-oauthlib==0.4.6
google-pasta==0.2.0
greenlet==1.1.2
grpcio==1.44.0
gym==0.23.1
gym-notices==0.0.6
h5py==2.10.0
hellonlp==0.2.41
huggingface-hub==0.4.0
hupper==1.10.3
idna==3.3
importlib-metadata==4.11.1
importlib-resources==5.4.0
ipykernel==6.9.1
ipython==7.32.0
ipython-genutils==0.2.0
ipywidgets==7.6.5
itsdangerous==2.1.2
jedi==0.18.1
jieba==0.42.1
Jinja2==3.0.3
joblib==1.1.0
json5==0.9.6
jsonlines==3.0.0
jsonschema==4.4.0
jupyter-client==7.1.2
jupyter-console==6.4.0
jupyter-core==4.9.2
jupyter-server==1.13.5
jupyterlab==3.2.9
jupyterlab-pygments==0.1.2
jupyterlab-server==2.10.3
jupyterlab-widgets==1.0.2
Keras==2.3.1
Keras-Applications==1.0.8
Keras-Preprocessing==1.1.2
kiwisolver==1.3.2
lab==7.0
loguru==0.6.0
lshash3==0.0.8
lxml==4.8.0
Markdown==3.3.6
MarkupSafe==2.1.0
matplotlib==3.1.2
matplotlib-inline==0.1.3
mistune==0.8.4
MouseInfo==0.1.3
multidict==6.0.2
multiprocess==0.70.12.2
nbclassic==0.3.5
nbclient==0.5.11
nbconvert==6.4.2
nbformat==5.1.3
nest-asyncio==1.5.4
networkx==2.6.3
nlp-basictasks==0.2.2
nltk==3.7
notebook==6.4.8
numpy==1.17.0
oauthlib==3.2.0
opencv-python==4.1.2.30
packaging==21.3
paddle-ernie==0.2.0.dev1
paddlepaddle==2.2.2
pandas==1.1.5
pandocfilters==1.5.0
parso==0.8.3
PasteDeploy==2.1.1
pathlib2==2.3.7.post1
pbkdf2==1.3
pickleshare==0.7.5
Pillow==8.2.0
pkgconfig==1.5.4
plaster==1.0
plaster-pastedeploy==0.7
prometheus-client==0.13.1
prompt-toolkit==3.0.28
protobuf==3.19.4
pyarrow==7.0.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
PyAutoGUI==0.9.53
pycocotools==2.0.4
pycparser==2.21
pygame==2.1.2
PyGetWindow==0.0.9
Pygments==2.11.2
pygtrie==2.4.2
PyMsgBox==1.0.9
pyparsing==3.0.7
pyperclip==1.8.2
pyramid==1.10
pyramid-mailer==0.15.1
PyRect==0.2.0
pyrsistent==0.18.1
PyScreeze==0.1.28
python-dateutil==2.8.2
python-docx==0.8.11
python3-openid==3.2.0
pytweening==1.0.4
pytz==2021.3
pywin32==303
pywinpty==1.1.6
PyYAML==6.0
pyzmq==22.3.0
qtconsole==5.2.2
QtPy==2.0.1
regex==2022.1.18
repoze.sendmail==4.4.1
requests==2.27.1
requests-oauthlib==1.3.1
responses==0.18.0
rsa==4.8
sacremoses==0.0.47
scikit-learn==1.0.2
scipy==1.7.3
seaborn==0.11.2
selenium==2.48.0
Send2Trash==1.8.0
sentence-transformers==2.2.0
sentencepiece==0.1.96
seqeval==1.2.2
simcse==0.4
simplejson==3.17.6
six==1.16.0
sklearn==0.0
smart-open==5.2.1
SmoothNLP==0.4.0
sniffio==1.2.0
SQLAlchemy==1.4.32
tensorboard==1.14.0
tensorboard-data-server==0.6.1
tensorboard-plugin-wit==1.8.1
tensorflow-estimator==1.14.0
tensorflow-gpu==1.14.0
termcolor==1.1.0
terminado==0.13.1
testpath==0.6.0
threadpoolctl==3.1.0
tokenizers==0.11.5
torch==1.10.2+cu102
torchaudio==0.10.2+cu102
TorchCRF==1.1.0
torchvision==0.11.3+cu102
tornado==6.1
tqdm==4.60.0
traitlets==5.1.1
transaction==3.0.1
transformers==4.17.0
translationstring==1.4
txt2tags==3.7
typing_extensions==4.1.1
urllib3==1.26.8
utils==1.0.1
velruse==1.1.1
venusian==3.0.0
wcwidth==0.2.5
webencodings==0.5.1
WebOb==1.8.7
websocket-client==1.3.1
Werkzeug==2.0.3
widgetsnbextension==3.5.2
win32-setctime==1.1.0
wrapt==1.14.0
WTForms==3.0.1
wtforms-recaptcha==0.3.2
xlrd==1.2.0
xxhash==3.0.0
yapf==0.32.0
yarl==1.7.2
然后使用
pip install -r C:\Users\wang\Desktop\pycharm作业\yolov5-pytorch-main\yolov5-pytorch-main\requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/
就可以快速的把环境所需要的包下载下来!
下面的是其他的辅助你可详细看
(1)pip国内的一些镜像
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
pip install statsmodels -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.douban.com
python37 -m pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
pip install pygame -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.douban.com
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#pip install --upgrade jupyter
a.临时使用:
可以在使用pip的时候在后面加上-i参数,指定pip源
示例: pip install bs4-i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.douban.com 后边这个代码是信任这个网址的意思
库名称
pip install torchtext -i http://pypi.mirrors.ustc.edu.cn/simple/ --trusted-host pypi.mirrors.ustc.edu.cn
普通的:pip install scipy==1.2.1 速度很慢
国内源变形:pip install --user tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple/ 指定国内源速度很快
此处空格
python37 -m pip install transformers -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install torch-geometric -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install PyHamcrest==1.9.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install torch_scatter-1.0.2 (1).tar.gz
pip install torch_scatter-latest+cpu-cp36-cp36m-win_amd64.whl
进入anadacon创建的pytorch屋子环境 conda activate pytorch
torch安装包:网址:https://download.pytorch.org/whl/torch_stable.html
conda pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html
cp35是支持python3.5版本的文件
pytorch离线安装网址
pytorch官网:https://pytorch.org/
一、清华镜像源方案
该方案就是将官网的下载路径,改到清华镜像源的路径,先用activate激活自己之前创建的环境后,在命令行输入以下代码:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
然后再去pytorch官网复制下载代码,记得删掉后面的-c pytorch,因为它表示从官网进行下载,不从清华镜像源下。
python37 -m pip install torch==1.5.1+cpu torchvision==0.6.1+cpu -f https://download.pytorch.org/whl/torch_stable.html