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 ...
随机推荐
- struts 类型转换
- BZOJ1113 [Poi2008]海报PLA 【分治 + 线段树】
题目链接 BZOJ1113 题解 显然只与高有关,每次选择所有海报中最低的覆盖所有海报,然后分治两边 每个位置会被调用一次,复杂度\(O(nlogn)\) \(upd:\)智障了,,是一道\(O(n) ...
- 【spoj SUBLEX】 Lexicographical Substring Search
http://www.spoj.com/problems/SUBLEX/ (题目链接) 题意 给出一个字符串,询问其中字典序第K小的子串. Solution 后缀自动机例题. 构出后缀自动机以后,对每 ...
- Android Studio 换主题 + 背景图片 + 去掉白色竖线
1.去掉AS编辑区域右边的白色竖线: 把right margin 设置的大一点就可以了,默认是120 ,设置成 1200就ok了 2.AS主题下载换装 可以去如下网站下载,然后导入jar, 具体用法百 ...
- 最新版的Android4.4.2 SDK无法下载解决
http://hi.baidu.com/petercao2008/item/65362d2bdbddfacba5275a50 问题: Downloading ARM EABI v7a System I ...
- 解题:POI 2011 Dynamite
题面 从零开始的DP学习系列之叁 树形DP的基本(常见?)思路:先递归进儿子,然后边回溯边决策,设状态时常设$dp[x]$表示以$x$为根的子树中(具体分析算不算$x$这个点)的情况 显然的二分答案, ...
- Python实现类似JavaScript 的Json对象
Python实现类似JavaScript 的Json对象 用过js的都知道 js中json也是一个对象,所以可以直接通过class.attr 取值,当attr不存在时也不会报错,那么Python可不可 ...
- 使用 laravel 的 queue 必须知道的一些事
1. 在修改 queue 相关代码后,必须要使用 php artisan queue:restart 来重启队列服务,否则所做的修改可能不会生效(没法重现了,按理说应该和使用 queue:listen ...
- sql 事务的四种隔离级别
在 SQL 标准中定义了四种隔离级别,每一种级别都规定了一个事务中所做的修改,哪些在事务内和事务间是可见的,哪些是不可见的.较低级别的隔离通常可以执行更高的并发,系统的开销也更低. read unco ...
- libcurl代码示例
http://note.youdao.com/noteshare?id=e60a679d1731c870ff45e403de81a2c0