linux新手,我在virtualenv中安装了django,但我无法导入django。我需要设置任何可变路径吗?
(virs) akash@akash-Inspiron-3542:/usr/virs/bin$ django-admin --version
1.11.10
(virs) akash@akash-Inspiron-3542:/usr/virs/bin$ python
Python 3.6.4 (default, Jan 28 2018, 17:52:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'django'
答案 0 :(得分:1)
如果要访问python shell内的django库,则需要使用git fsck Checking object directories: 100% (256/256), done.
error in commit fda45b4b6b06f6b815341c1f26de827c769f48b6: badDate: invalid
author/committer line - bad date error in commit
636d259fd0ac343af2a5561ff799a54a6aeb9b1c: badDate: invalid
author/committer line - bad date error in commit
41dc786816992e3c42c904e8c848aa1078475386: badDate: invalid
author/committer line - bad date error in commit
c55a0fa0d98e02aa4621be202d7b7d21ed2ff2ab: badDate: invalid
author/committer line - bad date error in commit
e6ad8f5ea7cf6441b6ea6ab5583117113a8f49fb: badDate: invalid
author/committer line - bad date error in commit
4aea97fdd999484319a9fbbc4dc42b024e1eba80: badDate: invalid
author/committer line - bad date error in commit
531f7783e383868c1d52a1bf2dc3212f5e10a91c: badDate: invalid
author/committer line - bad date Checking objects: 100% (546/546),
done.
。
这是一个例子。
尝试:
manage.py
或
django-admin startproject mysite
cd mysite
./manage.py shell
这就是在python shell中访问django库的样子。在这种情况下,我使用IPython。如果您尚未安装IPython,请使用python shell自动python manage.py shell
。
manage.py
答案 1 :(得分:0)
请运行此命令并在此处写入结果。
whereis django-admin
可能! django-admin命令从virtualenv中运行
答案 2 :(得分:0)
运行命令
pip install django