Skip to Content
Python数据处理
book

Python数据处理

by Jacqueline Kazil, Katharine Jarmul
July 2017
Intermediate to advanced
398 pages
11h 54m
Chinese
Posts & Telecom Press
Content preview from Python数据处理
高级
Python
设置
359
一旦你退出了,你会回到命令行。现在我们有了一个叫
testprojects
的环境,有
3
个库已经
安装。但是如果我们致力于其他项目,想要有另一个环境呢?首先,输入下面的命令禁用
当前的环境:
$ deactivate
之后创建一个新的叫作
sandbox
的环境:
$ mkvirtualenv sandbox
完成之后,你会进入新环境。如果输入
pip freeze
,你会看到这个环境还没有安装
IPython
。因为这是一个全新的环境,与
testprojects
环境完全分离。如果我们在这个环境中
安装
IPython
,它会在计算机上安装第二个实例。这保证我们在一个环境中所做的任何事
不会影响其他的环境。
为什么它很重要?随着新项目的进行,你会想安装不同的库以及不同版本的库。我们建议
为本书创建一个虚拟环境,但是如果你启动了一个新的项目,你会想要创建一个新的虚拟
环境。正如你所见,随着项目的切换,在不同的环境中切换是很容易的。
有时候,你可能会碰到所有依赖都存储在一个名为
requirements.txt
文件中的仓库。库作者
使用虚拟环境和
pip freeze
来保存列表,这样用户可以安装库和依赖。从
requirements
件安装包,你需要运行
pip install -r requirements.txt
我们知道如何创建和禁用环境,但是我们不知道如何激活一个已经存在的环境。为了
激活我们名为
sandbox
的样例环境,输入下面的命令(如果你已经在其中了,需要先
deactivate
它,来看有什么区别) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

数据科学中的实用统计学(第2版)

数据科学中的实用统计学(第2版)

Peter Bruce, Andrew Bruce, Peter Gedeck
Java持续交付

Java持续交付

Daniel Bryant, Abraham Marín-Pérez
解密金融数据

解密金融数据

Justin Pauley

Publisher Resources

ISBN: 9787115459190