简体   繁体   English

Django项目无法在Mac OS X Sierra上运行

[英]Django project not able to run on mac OS X Sierra

I just purchased the new 2017 macbook pro. 我刚刚购买了新的2017 Macbook Pro。 I want to do two things. 我想做两件事。 the first is run a django project and then run my specific file that I have clones from github. 第一个是运行django项目,然后运行我从github克隆的特定文件。 I want to pip install django and I am getting a message that pip is not a command. 我想pip install django,并且收到一条消息,提示pip不是命令。

Every forum is saying that 2017 macbook pro has python 2.X and 3.XI want to set python 3.X as the default. 每个论坛都在说2017年的macbook pro具有python 2.x和3.xi想要将python 3.x设置为默认值。

How can i set python 3 as the default? 如何将python 3设置为默认值?

what is the command to get pip because when i try to get it from python 2.x and 3.x, it says the file does not exist. 获取pip的命令是什么,因为当我尝试从python 2.x和3.x获取它时,它说该文件不存在。

Where and how can I install pip? 我在哪里以及如何安装pip?

I tried installing pip but i was getting a message that it does not exist. 我尝试安装pip,但收到一条消息,提示它不存在。 how can i go about downloading or getting pip on my mac. 我该如何在Mac上下载或获取点子。 I have tried a few different ways and nothing is working. 我尝试了几种不同的方法,但没有任何效果。 Once i get python and pip, I can install Django and run my django application... 一旦获得python和pip,就可以安装Django并运行django应用程序...

Where and how can i install django framework onto my mac? 我在哪里以及如何在Mac上安装django框架?

Does anyone know how to do this on the OS X sierra for mac. 有谁知道如何在Mac的OS X sierra上执行此操作。

Yes, I use python on sierra Mac, but I suggest you to use brew to install Python3 and then use virtualenv to manage the env of your projects. 是的,我在sierra Mac上使用python,但我建议您使用brew安装Python3,然后使用virtualenv管理项目的环境。 Don't rely on the default python installed on Sierra. 不要依赖Sierra上安装的默认python。

Install brew is very easy. 安装brew很容易。 Just jump here: https://brew.sh/ 只是跳到这里: https//brew.sh/

After that you can install python simply running brew install python3 之后,您可以安装python,只需运行brew install python3

I prefer virtualenv and virtualenvwrapper , but if you want start immediately you can create your env from python3: 我更喜欢virtualenvvirtualenvwrapper ,但是如果要立即开始,可以从python3创建环境:

$ pyvenv myenv

And then activate your env 然后激活您的环境

$ source myenv/bin/activate

Now you can install any package with pip, without changing your system. 现在,您可以使用pip安装任何软件包,而无需更改系统。 Run deactivate to switch off your env. 运行deactivate以关闭您的环境。 You can create many envs as you wish and run your app with many different django version. 您可以根据需要创建许多环境,并使用许多不同的Django版本运行您的应用程序。

As I wrote before, I suggest you use virtualenvwrapper and virtualenv 如我之前所写,建议您使用virtualenvwrappervirtualenv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM