6

如何在 virtualenv 中安装 numpy...

easy_install numpy 抛出错误。我不能使用二进制安装程序,因为这会将 numpy 安装在 python 主安装而不是 virtualenv 中。

谢谢

4

2 回答 2

2

另一个(不太好的)解决方案是获取安装程序,将其安装到您的默认 Python 目录中,然后手动将其复制到您的 virtualenv。

长版

  1. 去这里:http ://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
  2. 安装它。
  3. 在您的 python 安装中找到它(可能在 C:\Python27\Lib\site_packages\numpy 或类似位置
  4. 将 numpy 目录复制到 $virtual_env\Lib\sites_packages\numpy。

为我工作,但它并不优雅。我认为 numpy 的网站上也有 exe 安装程序,但我发现当我需要东西时直接转到上面的安装程序比在其他各种网站上闲逛要容易。

于 2013-03-05T18:54:42.623 回答
1

You cannot use easy_install directly for fairly technical reasons I would rather not get into. There is a solution, albeit not optimal: once in the virtual environment, go into numpy sources, and run:

python setupegg.py install

The key point is using setupegg.py instead of setup.py.

于 2010-10-28T06:36:24.390 回答