简体   繁体   English

如何在pycharm中相应地选择python版本?

[英]how to choose python version accordingly in pycharm?

In last project, I used python 2.7.在上一个项目中,我使用了 python 2.7。 The new one have to run in python 3.5 so I installed 3.5.新的必须在 python 3.5 中运行,所以我安装了 3.5。 I choose Python 3.5 in Setting-->Python interpreter, and I got Error : Django is not importable in this environment.我在“设置”-->“Python 解释器”中选择了 Python 3.5,但出现Error : Django is not importable in this environment. Then I tried to run然后我试着跑

 pip install django
Requirement already satisfied (use --upgrade to upgrade): django in c:\python27\lib\site-packages
Cleaning up...

It seems that something wrong with the path, and how could I make it right?似乎路径有问题,我怎么能改正呢?

It's probably because the pip command points to python2.7 version of pip, and as django is already installed for python 2.7, you are getting the message you mentioned.这可能是因为 pip 命令指向 pip 的 python2.7 版本,并且由于已经为 python 2.7 安装了 django,您收到了您提到的消息。

You need to install django for python3.5.你需要为python3.5安装django。 To do that, either directly run pip executable inside python3.5 folder, or choose python3.5 as the interpreter from pycharm, and install django through the ui of pycharm.为此,要么直接运行python3.5文件夹中的pip可执行文件,要么在pycharm中选择python3.5作为解释器,并通过pycharm的ui安装django。

Depending on how you installed python3.5, you could also run根据您安装 python3.5 的方式,您还可以运行

pip3.5 install django

from the console to invoke python3.5 version of pip从控制台调用python3.5版本的pip

只是去pip3适合Python的3倍ENVS:

   pip3 install Django

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

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