Recently, I used python2.X to write RL test scripts for ros. In short, I found that python2 on Ubuntu appeared when using pip No module named pip
, but my python2 can be successfully started. So, I first
$ python -m ensurepip
Then popped up a bunch of:
ensurepip is disabled in Debian/Ubuntu for the system python.
Python modules For the system python are usually handled by dpkg and apt-get.
apt-get install python-<module name>
Install the python-pip package to use pip itself. Using pip together
with the system python might have unexpected results for any system installed
module, so use it on your own risk, or make sure to only use it in virtual
environments.
I guessed that the installation module was damaged, so I ran:
$ sudo apt --fix-broken install
Then reinstall pip:
$ sudo apt-get install python-pip
Finally, test whether it can be used normally:
$ python -m pip install gym
Collecting gym
Cache entry deserialization failed, entry ignored
Downloading https://mirrors.aliyun.com/pypi/packages/14/d3/d683fb120771489ae0a49bbaf6085942751c039f5f5e02e9775b7883c377/gym-0.16.0.tar.gz (1.6MB)
100% |████████████████████████████████| 1.6MB 661kB/s
Collecting cloudpickle~=1.2.0 (from gym)
Cache entry deserialization failed, entry ignored
Downloading https://mirrors.aliyun.com/pypi/packages/c1/49/334e279caa3231255725c8e860fa93e72083567625573421db8875846c14/cloudpickle-1.2.2-py2.py3-none-any.whl
Collecting numpy>=1.10.4 (from gym)
Cache entry deserialization failed, entry ignored
Downloading https://mirrors.aliyun.com/pypi/packages/3a/5f/47e578b3ae79e2624e205445ab77a1848acdaa2929a00eeef6b16eaaeb20/numpy-1.16.6-cp27-cp27mu-manylinux1_x86_64.whl (17.0MB)
100% |████████████████████████████████| 17.0MB 109kB/s
Collecting pyglet<=1.5.0,>=1.4.0 (from gym)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://mirrors.aliyun.com/pypi/packages/70/ca/20aee170afe6011e295e34b27ad7d7ccd795faba581dd3c6f7cec237f561/pyglet-1.5.0-py2.py3-none-any.whl (1.0MB)
100% |████████████████████████████████| 1.0MB 1.7MB/s
Collecting scipy (from gym)
Cache entry deserialization failed, entry ignored
Downloading https://mirrors.aliyun.com/pypi/packages/24/40/11b12af7f322c1e20446c037c47344d89bab4922b8859419d82cf56d796d/scipy-1.2.3-cp27-cp27mu-manylinux1_x86_64.whl (24.8MB)
100% |████████████████████████████████| 24.8MB 75kB/s
Collecting six (from gym)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://mirrors.aliyun.com/pypi/packages/ee/ff/48bde5c0f013094d729fe4b0316ba2a24774b3ff1c52d924a8a4cb04078a/six-1.15.0-py2.py3-none-any.whl
Collecting enum34~=1.1.6 (from gym)
Downloading https://mirrors.aliyun.com/pypi/packages/6f/2c/a9386903ece2ea85e9807e0e062174dc26fdce8b05f216d00491be29fad5/enum34-1.1.10-py2-none-any.whl
Collecting future (from pyglet<=1.5.0,>=1.4.0->gym)
Cache entry deserialization failed, entry ignored
Cache entry deserialization failed, entry ignored
Downloading https://mirrors.aliyun.com/pypi/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz (829kB)
100% |████████████████████████████████| 829kB 979kB/s
Building wheels for collected packages: gym, future
Running setup.py bdist_wheel for gym ... done
Stored in directory: /home/tianbot/.cache/pip/wheels/fe/04/2e/d02ccebb2d7b7127e8ab55190c70603f9658b13b5cff648d6b
Running setup.py bdist_wheel for future ... done
Stored in directory: /home/tianbot/.cache/pip/wheels/24/8f/e1/d0ff0db4b549668bcb3e3f2eaed50cdd35e3621ee69ea5dac0
Successfully built gym future
Installing collected packages: cloudpickle, numpy, future, pyglet, scipy, six, enum34, gym
Successfully installed cloudpickle-1.2.2 enum34-1.1.10 future-0.18.2 gym-0.16.0 numpy-1.16.6 pyglet-1.5.0 scipy-1.2.3 six-1.15.0
bingo