简体   繁体   English

找不到更新的python模块

[英]Cannot find the updated python module

I have installed the latest version of Python numpy module but when i tried to look for the version of the new numpy module, it still shows me the old version. 我已经安装了最新版本的Python numpy模块,但是当我尝试查找新的numpy模块的版本时,它仍然显示旧版本。

sudo pip install 'numpy==1.9.0'

python -c "import numpy; print numpy.__version__"
1.8.2

Here are my Python and pip versions 这是我的Python和pip版本

python --version
Python 2.7.6

pip --version
pip 8.1.2

Am i missing something here? 我在这里想念什么吗?

The version of pip you are using is not associated with the version of Python you're using. 您使用的pip版本与您使用的Python版本无关。 pip is installing NumPy into the miniconda distribution (BTW, are you aware that the latest version of NumPy is 1.11.3?), whereas your Python binary is reading its site-packages from elsewhere. pip正在将NumPy安装到miniconda发行版中(BTW,您是否知道NumPy的最新版本是1.11.3?),而您的Python二进制文件正在从其他地方读取其站点包。 To determine this, run 要确定这一点,运行

python

at the command prompt, then once in the interpreter run 在命令提示符下,然后在解释器中运行一次

>>> import sys
>>> print(sys.executable)
>>> from pprint import pprint as pp # makes reading the results easier
>>> pp(sys.path)

sys.executable will tell you which python binary you're running, and the sys.path list will tell you from where Python is importing its packages. sys.executable将告诉您正在运行的python二进制文件,而sys.path列表将告诉您Python从何处导入其软件包。

All this being said, you need to point your pip script to the version of Python you're actually using. pip ,您需要将pip脚本指向实际使用的Python版本。 The easiest way (IMO) is to download get-pip.py , then run either 最简单的方法(IMO)是下载get-pip.py ,然后运行

python get-pip.py

(after changing to the download directory) or (更改为下载目录后)或

sudo python get-pip.py

depending on whether you're an admin or not. 取决于您是否是管理员。 This will install the latest version of pip (currently 9.0.1) and associate it with the version of Python that was used to call the script. 这将安装最新版本的pip(当前为9.0.1),并将其与用于调用脚本的Python版本相关联。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM