GVKun编程网logo

Invent with Python

19

如果您对InventwithPython感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解InventwithPython的各种细节,此外还有关于cavarelinstallundercentos

如果您对Invent with Python 感兴趣,那么这篇文章一定是您不可错过的。我们将详细讲解Invent with Python 的各种细节,此外还有关于cavarel install under centos 6 with python 3 env、CentOs 7 同时安装python2、python3,如何创建独立的python3运行环境:virtualenv、CentOS 安装PIL(Python Imaging Library)及PIP(Python Package Installer)、centos6.2 安装virtualenv 来隔离python2 和python3 以及部署Django的实用技巧。

本文目录一览:

Invent with Python <Dragon>

Invent with Python

Python 文字游戏---Dragon Realm 

long long ago ,在一个岛上,住着很多龙.其中有善良的,也有凶残的。在玩家的面前有两个洞穴供选择。一个洞中的龙会将自己的财宝送给你。另外一个则会将玩家吃掉。come on!!!!

 

 

import time
import random

def displayInfo():
    print(''You are in a land full of dragons. In front of you.'')
    print(''you are tow caves.In one cave,the dragon is friednly'')
    print(''and will share his treasure with you .The other dragon'')
    print(''is greedy and hungry,and will eat you on sight.'')
    print()

def chooseCave():
    cave = ''''
    while cave!=''1'' and cave!=''2'':
        print(''Which cave will you go into ?(1 or 2)'')
        cave = raw_input()

    return cave

def checkCave(chosenCave):
    print(''You approach the cave ...'')
    time.sleep(2)
    print(''It is dark and spooky..'')
    time.sleep(2)
    print(''A large dragon jumps out in front of you ! He open his jaw and ..'')
    print()
    time.sleep(2)

    friendlyCave = random.randint(1,2)

    if chosenCave == str(friendlyCave):
        print(''Gives you his treasure!'')
    else:
        print(''Gobbles you down in on bite!'')

playAgain = ''yes''
while playAgain == ''yes'' or playAgain == ''y'':
    displayInfo()

    caveNumber = chooseCave()
    checkCave(caveNumber)

    print(''Do you want to play again ? (yes or no) '')
    playAgain = raw_input()

cavarel install under centos 6 with python 3 env

cavarel install under centos 6 with python 3 env

sudo yum upgrade python-setuptools
sudo yum -y install gcc libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel gcc-c++

# python变量
export PYTHONIOENCODING=utf-8

# python3 准备
./configure --prefix=/usr/local/python-3 --with-ssl
make -j 4
make install
virtualenv -p /usr/local/python-3/bin/python3.6 /usr/local/bienv
/usr/local/python-3/bin/python3.6 -m venv /usr/local/bienv

# Install caravel
pip install caravel --trusted-host pypi.douban.com
yum install sqlite-devel
pip install pysqlite

# Create an admin user
fabmanager create-admin --app caravel

# Initialize the database
caravel db upgrade

# Load some data to play with
caravel load_examples

# Create default roles and permissions
caravel init

# Start the web server on port 8088
caravel runserver -p 8088

CentOs 7 同时安装python2、python3,如何创建独立的python3运行环境:virtualenv

CentOs 7 同时安装python2、python3,如何创建独立的python3运行环境:virtualenv

  1. 安装完成python3
  2. pip3 install virtuallenv
  3. 检查virtualenv已安装,我的路径 /usr/local/python3/lib/python3.6/site-packages/virtualenv.py 
  4. python3   /usr/local/python3/lib/python3.6/site-packages/virtualenv.py /home/py3new (其中/home/py3new为独立运行环境目录)
  5. 进入/home/py3new/bin/检查python的版本 python3 

CentOS 安装PIL(Python Imaging Library)及PIP(Python Package Installer)

CentOS 安装PIL(Python Imaging Library)及PIP(Python Package Installer)

php小编香蕉为大家带来了一篇关于centos系统安装pil(python imaging library)及pip(python package installer)的教程。pil是一个强大的图像处理库,而pip是python的包管理工具,能够方便地安装和管理python的第三方库。在本篇教程中,我们将详细介绍如何在centos系统上安装和配置pil和pip,让您能够更好地利用python进行图像处理和包管理。无论您是初学者还是有一定经验的开发者,都可以通过本教程轻松上手,快速掌握相关技能。

CentOS 安装PIL(Python Imaging Library)及PIP(Python Package Installer)

在 CentOS 上安装 PIL(Python Imaging Library)和 PIP(Python Package Installer)是使用 Python 进行图像处理和安装第三方 Python 包的重要步骤,下面我将为您详细介绍如何在 CentOS 上安装 PIL 和 PIP。

安装 PIL

1. 确保您的系统已经安装了 Python 和 pip,在终端中运行以下命令来检查:

```css

立即学习“Python免费学习笔记(深入)”;

python --version

pip --version

```

如果未安装 Python 和 pip,请先安装它们。

2. 安装 PIL,运行以下命令来安装 PIL:

pip install pillow

Pillow 是 PIL 的一个分支,它提供了更多的功能和更好的维护。

安装 PIP

1. 如果您的系统尚未安装 PIP,可以通过以下命令进行安装:

python -m ensurepip --upgrade

这将确保您的系统上安装了最新版本的 PIP。

2. 使用 PIP 安装其他 Python 包,要安装 requests 包,运行以下命令:

pip install requests

这将下载并安装 requests 包及其依赖项,您可以使用类似的方法安装其他 Python 包。

注意事项

1. 在使用 PIP 安装 Python 包时,请确保您的网络连接正常,以便从 PyPI(Python Package Index)下载包及其依赖项。

2. 如果您在安装过程中遇到权限问题,请使用 sudo 命令以管理员身份运行 pip 命令,`sudo pip install requests`。

3. 如果您的系统上同时安装了多个 Python 版本,请使用对应版本的 pip 命令进行安装,例如 `pip3 install requests`。

4. 如果您需要更新已安装的 Python 包,请使用 `pip install --upgrade package_name` 命令进行升级。

5. 在使用第三方 Python 包时,请确保它们与您的 Python 版本兼容,以避免出现兼容性问题。

通过以上步骤,您可以在 CentOS 上成功安装 PIL 和 PIP,这些工具将帮助您在 CentOS 上使用 Python 进行图像处理和安装第三方 Python 包,希望这些信息对您有所帮助!如有任何疑问,请随时提问。

以上就是CentOS 安装PIL(Python Imaging Library)及PIP(Python Package Installer)的详细内容,更多请关注php中文网其它相关文章!

centos6.2 安装virtualenv 来隔离python2 和python3 以及部署Django

centos6.2 安装virtualenv 来隔离python2 和python3 以及部署Django

下载Python-3.6.0
https://download.csdn.net/download/linxi7/10328013

安装软件

yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel xz gcc zlib zlib-devel

安装

解压Python-3.6.0.tar.gz
mkdir /usr/local/python3
cd Python-3.6.0
./configure --prefix=/usr/local/python3
make
make install

虽然python3.6.0安装完了,但是目前直接python进去还是默认系统自带的2.6.6的。

安装virtualenv 和建立隔离的python3.6环境

#安装virtualenv
pip3 install virtualenv / pip install virtualenv
#创建项目环境
mkdir /tmp/test
#为目录创建虚拟环境 
virtualenv -p /usr/local/python3/bin/python3 /tmp/test/
#激活虚拟环境
source /tmp/test/bin/activate
#测试结果
[root@roe_jump_sg test]# source bin/activate
(test) [root@roe_jump_sg test]# python
Python 3.6.0 (default,Apr  4 2018,18:00:04) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux
Type "help","copyright","credits" or "license" for more information.
>>>

#退出环境变量 
deactivate

安装Django
https://download.csdn.net/download/linxi7/10328031

解压Django-1.11.6.tar.gz
进入刚刚解压的目录
python setup.py install 
进入python,import django测试看是否成功

这样就可以进行基于python3.6的Django项目开发或者环境部署了。

今天关于Invent with Python 的介绍到此结束,谢谢您的阅读,有关cavarel install under centos 6 with python 3 env、CentOs 7 同时安装python2、python3,如何创建独立的python3运行环境:virtualenv、CentOS 安装PIL(Python Imaging Library)及PIP(Python Package Installer)、centos6.2 安装virtualenv 来隔离python2 和python3 以及部署Django等更多相关知识的信息可以在本站进行查询。

本文标签: