Skip to content Skip to sidebar Skip to footer

Import Error: Anaconda Numpy (numpy And Anaconda Already Installed, Virtualenv)

I have a virtual environment my_env in which I installed Anaconda. When I type which python I get: /user/pkgs/anaconda2/envs/my_env/bin/python I have no errors importing numpy h

Solution 1:

Your shell script doesn't care about having a virtualenv active (it starts in a clean environment).

Instead of ../python_program.py you need to have the full executable path

export PYTHON_ENV=/user/pkgs/anaconda2/envs/my_env

 $PYTHON_ENV/bin/python ../python_program.py --filename $a1 ...

Or you can append this to the top of python_program.py

#!/usr/bin/env python

Refer: The importance of env (and how it works with virtualenv)

Post a Comment for "Import Error: Anaconda Numpy (numpy And Anaconda Already Installed, Virtualenv)"