如何在不改变ubuntu中的linux发行版的情况下升级numpy

时间:2022-07-03 21:22:58

I have numpy 1.11 on my 15.10 Ubuntu machine and I need the same version on my 12.04 machine. I am not sure if this is possible at all and do not understand enough of linux to know.

我的15.10 Ubuntu机器上有numpy 1.11,我的12.04机器上需要相同的版本。我不确定这是否可行,并且不了解linux的知识。

I have tried

我努力了

sudo pip install numpy --upgrade
sudo apt-get dist-upgrade

I tried reinstalling, etc. and nothing seems to work. Are the libraries simply not compatible or is there a way to do this?

我尝试重新安装等等,似乎没有任何工作。这些库是不兼容的还是有办法做到这一点?

I don't want to mess with the ubuntu version because this is a shared lab machine and I am worried that other people's experiments could have issues if I did.

我不想弄乱ubuntu版本,因为这是一个共享的实验室机器,我担心如果我这样做,其他人的实验可能会有问题。

EDIT: When I run the upgrade it says that it has installed successfully but doesn't say anything about the version.

编辑:当我运行升级它说它已成功安装但没有说明版本。

here is the tail end of the output when I run the upgrade:

这是运行升级时输出的尾端:

types -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/numpy/random/mtrand/mtrand.o build/temp.linux-x86_64-2.7/numpy/random/mtrand/randomkit.o build/temp.linux-x86_64-2.7/numpy/random/mtrand/initarray.o build/temp.linux-x86_64-2.7/numpy/random/mtrand/distributions.o -Lbuild/temp.linux-x86_64-2.7 -o build/lib.linux-x86_64-2.7/numpy/random/mtrand.so
Creating build/scripts.linux-x86_64-2.7/f2py
  adding 'build/scripts.linux-x86_64-2.7/f2py' to scripts
changing mode of build/scripts.linux-x86_64-2.7/f2py from 644 to 755

warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
changing mode of /usr/local/bin/f2py to 755
Successfully installed numpy
Cleaning up...

When I check my version:

当我检查我的版本时:

>>> import numpy
>>> numpy.version.version
'1.8.2'

4 个解决方案

#1


2  

What happens when you run

跑步时会发生什么

sudo pip install numpy --upgrade

?

When I run it, I get this:

当我运行它时,我得到了这个:

Does it Collecting numpy
  Downloading numpy-1.11.1.zip (4.7MB)
    100% |████████████████████████████████| 4.7MB 108kB/s 
Installing collected packages: numpy
  Found existing installation: numpy 1.9.2
    Uninstalling numpy-1.9.2:
      Successfully uninstalled numpy-1.9.2
  Running setup.py install for numpy

If you are seeing this, my next question would be: are you sure your paths are set correctly?

如果你看到这个,我的下一个问题是:你确定你的路径设置正确吗?

#2


2  

I find it is more reliable and repeatable to manage your python environment using the Anaconda python distribution. Rather than using apt-get, you would use conda as your python package management system and it should work fairly consistently across platforms especially with major packages like numpy.

我发现使用Anaconda python发行版来管理你的python环境更加可靠和可重复。您可以使用conda作为您的python包管理系统,而不是使用apt-get,它应该在各个平台上相当一致,尤其是像numpy这样的主要软件包。

#3


2  

Ok I resolved my Issue. I will summarize the problem:

好的我解决了我的问题。我将总结一下这个问题:

When I installed Scipy by installing the scipy pack it automatically resinstalls numpy 1.8 no materr what, even if it is just:

当我通过安装scipy包安装Scipy时,它会自动树立numpy 1.8 no materr什么,即使它只是:

sudo apt-get install python-scipy

What worked for me:

什么对我有用:

sudo apt-get purge python-numpy
sudo pip install numpy
sudo pip install scipy
sudo pip install -U scikit-learn

I don't know why the apt-get packages are not updated, maybe this is an issue that exists. Thank you all for your helpful orientations. :-)

我不知道为什么apt-get软件包没有更新,也许这是一个存在的问题。谢谢大家的帮助。 :-)

#4


1  

This should work

这应该工作

pip install --upgrade numpy 

Could you post the error message you received?

你能发贴你收到的错误信息吗?

The next time you are working on a project, you could use virtualenv. virtualenv will create an isolated environment for each of your projects with a copy of the python binary, the entire Python standard library, the pip installer as well as a copy of the site-packages directory. This way the environment would be local to you and would not affect the version of Python or its dependencies across all user accounts.

下次您正在处理项目时,可以使用virtualenv。 virtualenv将为每个项目创建一个隔离的环境,其中包含python二进制文件的副本,整个Python标准库,pip安装程序以及site-packages目录的副本。这样环境对您来说就是本地的,不会影响所有用户帐户的Python版本或其依赖关系。

#1


2  

What happens when you run

跑步时会发生什么

sudo pip install numpy --upgrade

?

When I run it, I get this:

当我运行它时,我得到了这个:

Does it Collecting numpy
  Downloading numpy-1.11.1.zip (4.7MB)
    100% |████████████████████████████████| 4.7MB 108kB/s 
Installing collected packages: numpy
  Found existing installation: numpy 1.9.2
    Uninstalling numpy-1.9.2:
      Successfully uninstalled numpy-1.9.2
  Running setup.py install for numpy

If you are seeing this, my next question would be: are you sure your paths are set correctly?

如果你看到这个,我的下一个问题是:你确定你的路径设置正确吗?

#2


2  

I find it is more reliable and repeatable to manage your python environment using the Anaconda python distribution. Rather than using apt-get, you would use conda as your python package management system and it should work fairly consistently across platforms especially with major packages like numpy.

我发现使用Anaconda python发行版来管理你的python环境更加可靠和可重复。您可以使用conda作为您的python包管理系统,而不是使用apt-get,它应该在各个平台上相当一致,尤其是像numpy这样的主要软件包。

#3


2  

Ok I resolved my Issue. I will summarize the problem:

好的我解决了我的问题。我将总结一下这个问题:

When I installed Scipy by installing the scipy pack it automatically resinstalls numpy 1.8 no materr what, even if it is just:

当我通过安装scipy包安装Scipy时,它会自动树立numpy 1.8 no materr什么,即使它只是:

sudo apt-get install python-scipy

What worked for me:

什么对我有用:

sudo apt-get purge python-numpy
sudo pip install numpy
sudo pip install scipy
sudo pip install -U scikit-learn

I don't know why the apt-get packages are not updated, maybe this is an issue that exists. Thank you all for your helpful orientations. :-)

我不知道为什么apt-get软件包没有更新,也许这是一个存在的问题。谢谢大家的帮助。 :-)

#4


1  

This should work

这应该工作

pip install --upgrade numpy 

Could you post the error message you received?

你能发贴你收到的错误信息吗?

The next time you are working on a project, you could use virtualenv. virtualenv will create an isolated environment for each of your projects with a copy of the python binary, the entire Python standard library, the pip installer as well as a copy of the site-packages directory. This way the environment would be local to you and would not affect the version of Python or its dependencies across all user accounts.

下次您正在处理项目时,可以使用virtualenv。 virtualenv将为每个项目创建一个隔离的环境,其中包含python二进制文件的副本,整个Python标准库,pip安装程序以及site-packages目录的副本。这样环境对您来说就是本地的,不会影响所有用户帐户的Python版本或其依赖关系。