Python/pytorch 切換國內源/AttributeError: module 'torch.jit' has no attribute 'unused'/not a trusted or secure host


Python/pytorch 切換國內源

python-pytorch在下載包的時候,會因為服務器在國外,導致下載速度太慢。這時候就需要切換為國內的源。

  • 使用

假設要安裝vedo庫,則在原來安裝語句上添加-i和鏡像地址即可。

pip install vedo -i https://pypi.tuna.tsinghua.edu.cn/simple/
  • 其他源
阿里雲 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/

導入torchvision出現:AttributeError: module ‘torch.jit‘ has no attribute ‘unused‘

導入torchvision出現:AttributeError: module 'torch.jit' has no attribute 'unused'錯誤

文章目錄:
1 問題原因
2 解決方法
我的本機環境:

windows10系統
torch1.2.0+cu92
torchvision
0.6.1+cu92
1 問題原因
我本機已經安裝了torch==1.2.0+cu92版本,后面開始安裝torchvision==0.6.1+cu92,成功安裝並且沒有出任何錯誤,但是在導入import torchvision的時候報錯:AttributeError: module 'torch.jit' has no attribute 'unused'

網上參考很多,都是說由於torch和torchvision的 版本導致的該錯誤。

2 解決方法
安裝torch版本為1.4.0

pip install torch==1.4.0 -f https://download.pytorch.org/whl/torch_stable.html

安裝torchvision版本為0.5.0

pip install torchvision==0.5.0 -f https://download.pytorch.org/whl/torch_stable.html

pycharm安裝包 pip源提示“not a trusted or secure host” 解決

問題:
The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'. Could not find a version that satisfies the requirement proxy (from versions: ) No matching distribution found for proxy
答案:
http://mirrors.aliyun.com/pypi/simple/
改成
https://mirrors.aliyun.com/pypi/simple/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM