无法更新 python 包 psutil
unable to update python package psutil
当我在 python 中检查 psutil 的版本时,它说我有版本 0.5.0
:
$ uname -a
Linux mypc 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux
$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.__version__
'0.5.0'
>>> psutil.virtual_memory()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'virtual_memory'
>>> psutil.__file__
'/usr/lib/pymodules/python2.7/psutil/__init__.pyc'
我想升级到具有 virtual_memory()
方法的较新版本的 psutil:
$ sudo pip install 'psutil==2.2.1' --upgrade
Requirement already up-to-date: psutil==2.2.1 in /usr/local/lib/python2.7/dist-packages
Cleaning up...
同一个包的两个不同路径意味着 psutil
安装了两次:
/usr/local/lib/python2.7/dist-packages
/usr/lib/pymodules/python2.7/psutil/__init__.pyc
我只想要 psutil
版本 2.2.1
。什么是清理其他不需要的 0.5.0
包并仅保留此包的最佳方法?
根据评论 - 检查是否通过 dpkg
:
安装了上述任一路径
$ dpkg -S /usr/local/lib/python2.7/dist-packages
dpkg-query: no path found matching pattern /usr/local/lib/python2.7/dist-packages
$ dpkg -S /usr/lib/pymodules/python2.7/psutil/__init__.pyc
dpkg-query: no path found matching pattern /usr/lib/pymodules/python2.7/psutil/__init__.pyc
删除 psutil
的所有版本并重新安装 2.2.1
:
$ sudo pip uninstall psutil
Uninstalling psutil:
/usr/local/lib/python2.7/dist-packages/_psutil_linux.so
/usr/local/lib/python2.7/dist-packages/_psutil_posix.so
/usr/local/lib/python2.7/dist-packages/psutil
/usr/local/lib/python2.7/dist-packages/psutil-2.2.1.egg-info
Proceed (y/n)? y
Successfully uninstalled psutil
$ sudo apt-get remove --purge python-psutil
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
python-psutil*
0 upgraded, 0 newly installed, 1 to remove and 294 not upgraded.
After this operation, 215 kB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 183978 files and directories currently installed.)
Removing python-psutil ...
Processing triggers for python-support ...
$ sudo pip install 'psutil==2.2.1'
Downloading/unpacking psutil==2.2.1
Downloading psutil-2.2.1.tar.gz (223Kb): 223Kb downloaded
Running setup.py egg_info for package psutil
warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing collected packages: psutil
Running setup.py install for psutil
building '_psutil_linux' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_VERSION=221 -I/usr/include/python2.7 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_linux.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/psutil/_psutil_linux.o -o build/lib.linux-x86_64-2.7/_psutil_linux.so
building '_psutil_posix' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c psutil/_psutil_posix.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_posix.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/psutil/_psutil_posix.o -o build/lib.linux-x86_64-2.7/_psutil_posix.so
warning: no previously-included files matching '*' found under directory 'docs/_build'
Successfully installed psutil
Cleaning up...
$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.__version__
'2.2.1'
>>> psutil.__file__
'/usr/local/lib/python2.7/dist-packages/psutil/__init__.pyc'
当我在 python 中检查 psutil 的版本时,它说我有版本 0.5.0
:
$ uname -a
Linux mypc 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux
$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.__version__
'0.5.0'
>>> psutil.virtual_memory()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'virtual_memory'
>>> psutil.__file__
'/usr/lib/pymodules/python2.7/psutil/__init__.pyc'
我想升级到具有 virtual_memory()
方法的较新版本的 psutil:
$ sudo pip install 'psutil==2.2.1' --upgrade
Requirement already up-to-date: psutil==2.2.1 in /usr/local/lib/python2.7/dist-packages
Cleaning up...
同一个包的两个不同路径意味着 psutil
安装了两次:
/usr/local/lib/python2.7/dist-packages
/usr/lib/pymodules/python2.7/psutil/__init__.pyc
我只想要 psutil
版本 2.2.1
。什么是清理其他不需要的 0.5.0
包并仅保留此包的最佳方法?
根据评论 - 检查是否通过 dpkg
:
$ dpkg -S /usr/local/lib/python2.7/dist-packages
dpkg-query: no path found matching pattern /usr/local/lib/python2.7/dist-packages
$ dpkg -S /usr/lib/pymodules/python2.7/psutil/__init__.pyc
dpkg-query: no path found matching pattern /usr/lib/pymodules/python2.7/psutil/__init__.pyc
删除 psutil
的所有版本并重新安装 2.2.1
:
$ sudo pip uninstall psutil
Uninstalling psutil:
/usr/local/lib/python2.7/dist-packages/_psutil_linux.so
/usr/local/lib/python2.7/dist-packages/_psutil_posix.so
/usr/local/lib/python2.7/dist-packages/psutil
/usr/local/lib/python2.7/dist-packages/psutil-2.2.1.egg-info
Proceed (y/n)? y
Successfully uninstalled psutil
$ sudo apt-get remove --purge python-psutil
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
python-psutil*
0 upgraded, 0 newly installed, 1 to remove and 294 not upgraded.
After this operation, 215 kB disk space will be freed.
Do you want to continue [Y/n]? Y
(Reading database ... 183978 files and directories currently installed.)
Removing python-psutil ...
Processing triggers for python-support ...
$ sudo pip install 'psutil==2.2.1'
Downloading/unpacking psutil==2.2.1
Downloading psutil-2.2.1.tar.gz (223Kb): 223Kb downloaded
Running setup.py egg_info for package psutil
warning: no previously-included files matching '*' found under directory 'docs/_build'
Installing collected packages: psutil
Running setup.py install for psutil
building '_psutil_linux' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DPSUTIL_VERSION=221 -I/usr/include/python2.7 -c psutil/_psutil_linux.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_linux.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/psutil/_psutil_linux.o -o build/lib.linux-x86_64-2.7/_psutil_linux.so
building '_psutil_posix' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c psutil/_psutil_posix.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_posix.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/psutil/_psutil_posix.o -o build/lib.linux-x86_64-2.7/_psutil_posix.so
warning: no previously-included files matching '*' found under directory 'docs/_build'
Successfully installed psutil
Cleaning up...
$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil
>>> psutil.__version__
'2.2.1'
>>> psutil.__file__
'/usr/local/lib/python2.7/dist-packages/psutil/__init__.pyc'