环境
PythonCUDA3.6.910.1安装的pytorch版本
torchtorchvision1.2.00.4.0pytorch官网 选择自己需要的版本,复制命令,在终端输入
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch问题:安装好之后训练,发现数据不能传到GPU上 查找原因:conda list 中只有pytorch,没有 torch 和 torchvision
卸载重新安装pytorch后运行代码 报错
RuntimeError: CUDA error: invalid device ordinal查找原因:太复杂了,没仔细看
报错
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.原因:国内源太慢
用语句控制超时,具体参数为 --default-timeout=100, 后面的时间可以自己指定。
pip --default-timeout=100 install torch==1.2.0 torchvision==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html可以安装,但是速度还是太慢
更换pip源
手动换源(每次都需要加上) pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ torch==1.2.0 torchvision==0.4.0 -f https://download.pytorch.org/whl/torch_stable.html 永久换源 在主目录下创建.pip文件夹,在.pip文件夹中创建文件pip.conf mkdir ~/.pip vim ~/.pip/pip.confp.conf`文件内容如下:
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple/ trusted-host = pypi.tuna.tsinghua.edu.cn部分国内源
机构地址清华https://pypi.tuna.tsinghua.edu.cn/simple/阿里云http://mirrors.aliyun.com/pypi/simple/中国科技大学https://pypi.mirrors.ustc.edu.cn/simple/华中理工大http://pypi.hustunique.com/山东理工大http://pypi.sdutlinux.org/豆瓣http://pypi.douban.com/simple/引用 https://blog.csdn.net/Just_youHG/article/details/102744928