我对dajngo的postgresql数据库有问题。当我运行命令“python-mpipinstallpsycopg2”时,它可以工作。所以我运行命令“python管理.pymakemigrations“,我有这个问题:
command result1
command result2
但当我运行命令“pip freeze”时,结果是:
Django==2.2.6
心理2==2.8.4
pytz==2019.3
sqlparse==0.3.0
这是我的设置.py文件(数据库):
my settings.py - database
这是我的配置:
Windows 10 64位
-Django 2.2.6
-心理学2.8.4
-Postgresql 12
-pip 19.3.1
C:\XXX\PostgreSQL\12\bin在我的路径中。 我使用visualstudio代码IDE。在
0。安装miniconda
1。conda基本用法
非常简单:
conda env list
conda create name <my_env_name>
conda activate <my_env_name>
或source activate <my_env_name>
conda deactivate
或source deactivate
输入conda env后:
conda install <package-name>
大多数使用-c <reponame>
和 最受欢迎的回购是:conda-forge
,anaconda
或生物信息学bioconda
(非常最新)conda remove <package-name>
conda list
所以你看到的都和virtualenv很相似。在
2。搜索conda包安装命令
只需google
conda install <packagename>
就可以找到大部分anaconda
网站 使用正确的命令(-c whatever
)以及操作系统和版本。。。在然而,康达的包装大多不是一流的。皮普更顶尖。 把这个问题安装到环境中解决。在
3。创建环境并安装python和pip
因此
^{pr2}$conda install -c conda-forge python
之后的输出是:将安装以下新软件包:
所以它会自动用python安装pip。 因此,在安装之后,您还需要
pip
来安装到中 康达环境!在我所做的是我试图找到康达安装所需的软件包。 如果我不能用conda得到想要的版本或软件包, 在这个环境中,我切换到
pip install
。 由于Pip是本地安装到虚拟env中的,所以它将在本地安装 一切都进入康达环境。 (顺便说一句,我意识到,也许你在一开始使用了一个全球pip和 你的虚拟环境里一点都没有?可能这就是问题所在?)在4。将postgresql安装到conda env中
输入conda env后,请执行以下操作:
5。在django中设置postgresql
我使用的源代码是:[this][http://krischer.github.io/jane/setup/index.html#building-the-documentation]和[this][http://krischer.github.io/jane/setup/index.html#postgresql-setup]。在
django使用的数据库是一个内部数据库。在
首先初始化外部(基本)数据库:
在该状态下-创建非超级用户
创建一个内部数据库
这是你需要告诉django的数据库 此用户和此密码。在
所以您设置
settings.py
:然后做:
如果事情不起作用,你必须杀死博士后才能重新开始。在
但我不知道你是怎么杀死windows中的postgres进程的。。。(也许你可以添加如何在windows中做到这一点?)在
重新启动postgresql:
相关问题 更多 >
编程相关推荐