如何让我的计算机知道我现在要使用python 3?

问题描述 投票:0回答:1

我安装了mac和python 2.something。我最近安装了python3和pip3。然后我尝试运行以下命令:

pip3 install django==2.2

django-admin startproject myProject

cd myProject

一切正常,但是当我跑步时

python3 manage.py runserver

抱怨

Traceback (most recent call last):
  File "manage.py", line 10, in main
    from django.core.management import execute_from_command_line
ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 16, in main
    ) from exc
ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?

我的计算机仍在考虑旧版本吗?我不熟悉“环境变量”,我需要对其进行修改吗? (我问是因为我也读到,修改这些内容可能是不安全的)

也,当我跑步时

python --version

它给我2.7

python django pythonpath
1个回答
0
投票

我建议您使用https://github.com/pypa/pipenv。它可以轻松支持和使用不同的Python版本及其依赖的软件包等。

© www.soinside.com 2019 - 2024. All rights reserved.