如何为Django应用程序安装tensorflow
我正在尝试将tensorflow用于django web应用程序。我使用以下命令在anaconda中安装了tensor flow如何为Django应用程序安装tensorflow,django,tensorflow,Django,Tensorflow,我正在尝试将tensorflow用于django web应用程序。我使用以下命令在anaconda中安装了tensor flow conda create -n tensorflow_env tensorflow conda activate tensorflow_env 现在我尝试导入tensor flow并在django shell中执行下面的脚本,但我得到了一个错误 ModuleNotFoundError: No module named 'tensorflow' 我读过类似的问题,但
conda create -n tensorflow_env tensorflow
conda activate tensorflow_env
现在我尝试导入tensor flow并在django shell中执行下面的脚本,但我得到了一个错误
ModuleNotFoundError: No module named 'tensorflow'
我读过类似的问题,但他们说tensorflow环境不同于conda环境。如何确保tensorflow导入在我的anaconda环境中工作。我对这些环境很困惑
这是我的密码
from django.db.models import Avg,Sum
from django.db.models.functions import TruncDate
import pandas as pd
import tensorflow as tf
import matplotlib as mpl
import matplotlib.pyplot as plt
# Create your views here.
from myapp.models import Order
orders = Order.objects.all().annotate(date = TruncDate('timestamp')).values('itemName','date').annotate(itemPrice = Avg('itemPrice'),quantity=Sum('quantity'),orderPrice = Sum('orderPrice'))
df = pd.DataFrame(list(orders))
我曾经
而不是
conda create -n tensorflow_env tensorflow
conda activate tensorflow_env
以上几行创建了一个新环境tensorflow_env应足够:
pip install tensorflow
或者,您可以检查python的版本是否为32位或64位
pip install tensorflow