【发布时间】:2017-09-18 21:51:24
【问题描述】:
Ubuntu 16.04 LTS,尝试使用 pip 安装 cpickle。我搜索了一下,还没有找到任何有用的东西。
PYTHONPATH 未设置。
错误信息
user@hostname:~$ sudo -H pip3 install cpickle
Collecting cpickle
Using cached cpickle-0.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3.5/tokenize.py", line 454, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-wn926hef/cpickle/setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-wn926hef/cpickle/
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.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-q46tq1l8/cpickle/
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.
故障排除步骤
# version info
user@hostname:~$ python --version
Python 2.7.12
user@hostname:~$ python3 --version
Python 3.5.2
# I don't think cache is the problem
rm -rf ~/.cache/
sudo -H pip install cpickle --no-cache-dir # same problem
sudo -H pip3 install cpickle --no-cache-dir # same problem
【问题讨论】:
-
这是什么版本的python? Python 2.7 和 3.4 自带 cPickle
-
看起来你的
python是 python3 。pip用于 python2。请安装pip3......并使用pip3为Python3安装模块。 -
刚刚用版本更新问题,ctrl+f 表示“版本”
-
pip 和 pip3 有同样的问题
-
你为什么要使用 pip 安装
cPickle?它是 Python 标准库的一部分,因此要么已经安装(Python 2),要么选择pickle与cPickle是您不应该关心的实现细节(Python 3)。
标签: python linux bash python-3.x pip