pip pytorch安装时出现的问题
pytorch 的安装命令在官网就有,这里就不说了
执行安装命令
pip3 install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp35-cp35m-manylinux1_x86_64.whl
报错如下

可以知道是pip的版本太旧了,因此要更新pip的版本,用如下命令
sudo apt install python-pip
但是又报依赖关系出现问题
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: 处理软件包 python-pip (--configure)时出错:
子进程 已安装 post-installation 脚本 返回错误状态 1
正在设置 python-pkg-resources (20.7.0-1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: 处理软件包 python-pkg-resources (--configure)时出错:
子进程 已安装 post-installation 脚本 返回错误状态 1
dpkg: 依赖关系问题使得 python-setuptools 的配置工作不能继续:
python-setuptools 依赖于 python-pkg-resources (= 20.7.0-1);然而:
软件包 python-pkg-resources 尚未配置。 dpkg: 处理软件包 python-setuptools (--configure)时出错:
依赖关系问题 - 仍未被配置
正在设置 python-wheel (0.29.0-1) ...
因为错误消息指示这是由于上一个问题导致的错误,没有写入 apport 报告。
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
dpkg: 处理软件包 python-wheel (--configure)时出错:
子进程 已安装 post-installation 脚本 返回错误状态 1
由于已经达到 MaxReports 限制,没有写入 apport 报告。
在处理时有错误发生:
python-pip
python-pkg-resources
python-setuptools
python-wheel
E: Sub-process /usr/bin/dpkg returned an error code (1)
在安装是无法识别 ConfigParser一些包无法正确安装引起的,原因其实是我之前将python3设为系统的默认版本,
在Python 3中, ConfigParser 被重命名为 configparser
如果默认版本是Python3执行更新操作会报错
所以要切回python2才能正确安装
解决方案:
切换Python版本
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 200
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 100
如果要切回python3.x的话
mv /usr/bin/python /usr/bin/python2.x //对系统默认版本python进行操作
ln -s /usr/local/bin/python3.x /usr/bin/python //注意第一个路径是新安装的python版本路径,而第二个路径是系统默认路径
但是这样还是无法解决pytorch无法安装的问题,仍然报错
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
但是pip install --upgrade pip并不能升级到version 9.0.1
解决方案:
使用wget安装成功,具体如下:
sudo apt-get update
sudo apt-get upgrade
wget https://bootstrap.pypa.io/get-pip.py sudo python3 get-pip.py sudo apt-get install build-essential python-dev
sudo pip install uwsgi
但是不知道为什么,当我执行命令pip3 install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp35-cp35m-manylinux1_x86_64.whl时,
lai@lai-To-be-filled-by-O-E-M:~$ pip3 install torchvision
bash: /usr/bin/pip3: 没有那个文件或目录
只有root权限才能正常安装
lai@lai-To-be-filled-by-O-E-M:~$ sudo pip3 install torchvision
The directory '/home/lai/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/lai/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting torchvision
Downloading torchvision-0.1.9-py2.py3-none-any.whl (43kB)
100% |████████████████████████████████| 51kB 88kB/s
Requirement already satisfied: pillow in /usr/lib/python3/dist-packages (from torchvision)
Requirement already satisfied: six in /usr/lib/python3/dist-packages (from torchvision)
Requirement already satisfied: numpy in ./.local/lib/python3.5/site-packages (from torchvision)
Requirement already satisfied: torch in ./.local/lib/python3.5/site-packages (from torchvision)
Requirement already satisfied: pyyaml in ./.local/lib/python3.5/site-packages (from torch->torchvision)
Installing collected packages: torchvision
Successfully installed torchvision-0.1.9
pip pytorch安装时出现的问题的更多相关文章
- python的工具pip进行安装时出现 No module named 'pip'
现象: 解决: python -m ensurepip easy_install pip python -m pip install --upgrade pip #用于更新pip,默认安装的是pip9 ...
- 关于pip安装时提示"pkg_resources.DistributionNotFound"错误
使用pip install --upgrade pip升级pip中途失败,再次安装pip,完成后出现如下错误: 尝试重新安装pip也不行,同样会出现上述问题. 此时我们查看/usr/bin/pip文件 ...
- pip安装时遇到的问题集锦,持续更新!
1.Python安装时出现Could not fetch URL https://pypi.python.org/simple/pool/: There was a problem confirmin ...
- Python3.x:pip install pymssql安装时出错
Python3.x:pip install pymssql安装时出错 一.错误日志 error: Microsoft Visual C++ 14.0 is required. Get it with ...
- 如何解决pytorch 编译时CUDA版本与运行时CUDA版本不对应
转载请注明: 仰望高端玩家的小清新 http://www.cnblogs.com/luruiyuan/ 如何解决pytorch 编译时CUDA版本与运行时CUDA版本不对应 如果pytorch的编译时 ...
- NLP使用pytorch框架,pytorch安装
pytorch的安装方法及出现问题的解决方案: 安装pytorch,使用pip 安装,在运行代码的时候会报错,但是导包的时候不会报错,因此要采用conda的方式安装 1.找到miniconda的网 ...
- python入门:python包管理工具pip的安装
pip 是一个安装和管理 Python 包的工具 , 是 easy_install 的一个替换品. distribute是setuptools的取代(Setuptools包后期不再维护了),pip是e ...
- pip离线安装依赖包
pip安装离线本地包 导出本地已有的依赖包 pip freeze > requirements.txt 将依赖包下载到本地 # 下载到当前目录,指定pip源 pip download -r re ...
- pip install 安装出现问题:UnicodeEncodeError: 'ascii' codec can't encode characters in position XX的解决办法
pip install 安装出现问题:UnicodeEncodeError: 'ascii' codec can't encode characters in position XX的解决办法 转自c ...
随机推荐
- java线程dump分析工具
jstack和线程dump分析 java程序性能分析之thread dump和heap dump 一.[内存dump] jmap –dump:live,format=b,file=heap.bin ...
- Linux禁止root账户远程登录
Linux系统中,root用户几乎拥有所有的权限,远高于Windows系统中的administrator用户权限.一旦root用户信息被泄露,对于我们的服务器来说将是极为致命的威胁.所以禁止root用 ...
- python selenium2 定位一组元素find_elements实例
打开hao123首页,需要定位以上区域中的所有链接,他们有相同的父元素<ul class="js_bd site-bd site-hd0">,所有链接处在li>a ...
- c++11 左值引用、右值引用
c++11 左值引用.右值引用 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <string> #i ...
- BZOJ 2720: [Violet 5]列队春游
2720: [Violet 5]列队春游 Time Limit: 5 Sec Memory Limit: 128 MBSubmit: 189 Solved: 133[Submit][Status] ...
- 20135319zl字符集报告
字符集实验 ASCII 首先,查找ZHULI五个字符对应的ASCII码,5a 48 55 4c 49. 然后,用vim打开一个空文档,按下":",输入%!xxd 然后,输入 000 ...
- Solr7.2的安装与使用
单机安装Solr服务: https://www.cnblogs.com/LUA123/p/7906774.html extend: install_solr_service.sh 参数说明: 安装脚本 ...
- 设计模式之单例模式实现(C++)
#ifndef SINGLETON_H #define SINGLETON_H #include <cassert> #include <memory> #include &l ...
- Java入门:基础算法之计算三角形面积
本部分介绍如何计算三角形面积. /** * @author: 理工云课堂 * @description: 程序计算三角形的面积.三角形的底和高由用户输入 */ import java.util.Sca ...
- MySQL服务无法启动,错误代码1067
偶然间一次服务器意外重启 重启过后发现MySQL服务停止 手动启动之,发现无法启动 错误代码1067,进程意外终止 遂开始排查问题,首先想到的可能就是my.ini文件出了问题 但是已经忘了写过什么东西 ...