在Ubuntu 16.04和python3上安装Django [英] Installing Django on Ubuntu 16.04, python3

查看:145
本文介绍了在Ubuntu 16.04和python3上安装Django的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法在Ubuntu 16.04的python3上安装django. 这是我尝试过的:

I am unable to install django on python3 in ubuntu 16.04. Here is what I have tried:

1. pip3 install django
2. pip3 install --trusted-host pypi.python.org django
3. pip3 install --index-url=http://pypi.python.org/simple --trusted-host pypi.python.org django

我一直收到相同的错误:

I keep getting the same error:

Could not fetch URL https://pypi.python.org/simple/django/: There was a problem confirming the ssl certificate: Can't connect to HTTPS URL because the SSL module is not available. - skipping
Could not find a version that satisfies the requirement django (from versions: )
No matching distribution found for django

我在python 2.7上安装了Django,但在python 3.6上却需要它.

I have Django installed on python 2.7, but I need it on python 3.6.

我跑步时

sudo apt-get install python3-django

python3-django is already the newest version (1.8.7-1ubuntu5.5).

我相信这是因为我在python3.5上安装了python3.5和Django,但在3.6上需要它. Python3指的是python3.6.我的pip3是最新的.

I believe this is because I have python3.5 installed with Django on python3.5, but I need it on 3.6. Python3 refers python3.6. My pip3 is up to date.

感谢您的帮助.

推荐答案

16.04是LTS版本.因此,它被锁定到python 3.5.您可能已经注意到Xenial存储库中没有软件包,因此不得不从其他来源安装python 3.6.请注意这一点,因为事情可能会在系统级别中断.最后,我从源代码构建了python并使用生成了django venv.

16.04 is a LTS release. As such it is locked to python 3.5. You may have noticed that there were no packages in the Xenial repositories and had to install python 3.6 from alternate sources. Just be careful with that since things can break at the system level. In the end I went with building python from source and generating a django venv using.

python3.6 -m venv mydjangoproject

请参见发表更多信息.

有关工作的Ubuntu16.04 Python 3.6.3示例,请参见要点

See this gist for a working Ubuntu16.04 Python 3.6.3 example

这篇关于在Ubuntu 16.04和python3上安装Django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆