我目前正在使用一个依赖于2.7.0或更高版本请求的
python包,但我系统中的请求Ubuntu 14.04是版本2.2.1.我试图通过pip升级:
pip install requests==2.7.0
但它给了我一个错误,说:
Not uninstalling requests at /usr/lib/python2.7/dist-packages,owned by OS
我试图通过使用apt-get install –only-upgrade python-requests来升级它,但它说它已经在最新版本上(并且它不是).
然后我尝试在虚拟环境中安装,但它提供的信息与上面的pip消息相同.
最后,我想到了两个选择:
1-)通过apt-get卸载然后通过pip安装 – 我认为它太冒险了,因为它会卸载很多其他软件包.
2-)从github克隆并通过setup.py手动安装,但我也担心它可能会混乱其他软件包,具体取决于它
最好的方法是什么?我有什么简单的遗失吗?
这适用于Ubuntu 14.04:
原文链接:https://www.f2er.com/ubuntu/347200.html~ › 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,"credits" or "license" for more information. >>> import requests >>> requests.__version__ '2.9.1' >>>
我想知道为什么你的OS / Ubuntu版本的请求是2.2.1,而我的是2.0.1.您是否通过官方python-requests .deb包之外的其他机制手动安装了更新版本的请求?正如@wilbur在上面的评论中所建议的那样,你有可能在过去的某个时刻运行sudo pip安装请求吗?如果是这样,可能值得运行sudo pip卸载请求,看看你是否可以摆脱它…