Tal*_*dua 6 python ubuntu pip apt-get python-requests
我目前正在使用一个依赖于2.7.0或更高版本请求的python包,但我系统中的请求Ubuntu 14.04是版本2.2.1.我试图通过pip升级:
pip install requests==2.7.0
Run Code Online (Sandbox Code Playgroud)
但它给了我一个错误,说:
Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS
Run Code Online (Sandbox Code Playgroud)
我试图通过使用升级它apt-get install --only-upgrade python-requests,但它说它已经在最新版本(并且它不是).
然后我尝试在虚拟环境中安装,但它提供的信息与上面的pip消息相同.
最后,我想到了两个选择:
1-)通过apt-get卸载然后通过pip安装 - 我认为它太冒险了,因为它会卸载很多其他软件包.
2-)从github克隆并通过setup.py手动安装,但我也担心它可能会混乱其他软件包,具体取决于它
最好的方法是什么?我有什么简单的遗失吗?
这在Ubuntu 14.04上对我有效:
~ › sudo apt-get install -u python-requests
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-requests is already the newest version.
python-requests set to manually installed.
0 to upgrade, 0 to newly install, 0 to remove and 15 not to upgrade.
~ › python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.0.1'
>>>
~ › mkvirtualenv test
New python executable in test/bin/python
Installing setuptools, pip, wheel...done.
~ (test) › pip install requests
Collecting requests
Using cached requests-2.9.1-py2.py3-none-any.whl
Installing collected packages: requests
Successfully installed requests-2.9.1
~ (test) › python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.9.1'
>>>
Run Code Online (Sandbox Code Playgroud)
我想知道为什么您的OS / Ubuntu请求版本是2.2.1,而我的版本是2.0.1。您是否通过官方python-requests .deb软件包以外的其他机制手动安装了较新版本的请求?如@wilbur在上面的评论中所建议的,您是否有可能sudo pip install requests在过去某个时候跑步过?如果是这样,那么值得一试sudo pip uninstall requests,看看是否可以摆脱它...
| 归档时间: |
|
| 查看次数: |
6506 次 |
| 最近记录: |