我正在尝试在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
是 python3 。pip
适用于 python2。请安装pip3
……并使用 pip3 安装 Python3 的模块。 - Knud LarsencPickle
?它是Python标准库的一部分,因此它已经被安装了(Python 2),或者在Python 3中选择pickle
与cPickle
之间是一个实现细节,你不应该关心。 - jwodder