add2virtualenv (virtualenv wrapper) does not work with scipy

后端 未结 1 1301
小鲜肉
小鲜肉 2021-01-18 07:34

I want to create a virtualenv without global python packages, but with the scipy distribution that is shared; installing scipy takes quite a while and I don\'t want to go th

相关标签:
1条回答
  • 2021-01-18 08:25

    So, to summarize, the actual problem here is that the directory including the packages to be imported must be used, instead of the specific package. That is, instead of

    add2virtualenv /Library/Python/2.7/site-packages/scipy
    

    It should be

    add2virtualenv /Library/Python/2.7/site-packages
    

    Beware: this solution has the drawback that you do not only include scipy, but any other packages in /Library/Python/2.7/site-packages.


    An alternate, space-efficent solution could be symlinking scipy directory inside the virtual env's site-package. This can be done, in your virtual env, through:

    cdsitepackages
    ln -s /Library/Python/2.7/site-packages/scipy scipy
    

    All credits go to @rubik (see the comments)

    Check out this answer to find your site-packages path in case it is different than the one used here.

    0 讨论(0)
提交回复
热议问题