如何在Python(3.5.1)中添加/使用库 [英] How to add/use libraries in Python (3.5.1)

查看:120
本文介绍了如何在Python(3.5.1)中添加/使用库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在使用python,现在已经扩展到通过网站进行抓取等工作,以及其他很酷的工作,并且我需要为lxml,pandas,urllib2等导入新的库.因此,我安装了Python 3.5.1,并且还在使用Wing IDE.我(认为)还设法使用此教程 ,但是在

I've recently been playing around with python and have now expanded into doing stuff like scraping through websites and other cool stuff and I need to import new libraries for these things like lxml, pandas, urllib2 and such. So I have Python 3.5.1 installed and is also using Wing IDE. I (think) also managed to install pip using this tutorial, but then got lost after the

运行python get-pip.py

Run python get-pip.py

部分.

那么我将如何安装这些库来尝试新项目?谢谢!

So how would I go about installing those libraries to try new projects? Thanks!

推荐答案

如果您有,或者您可以创建文件requirements.txt,其中包含要为ex安装的库:

if u have or you can create a file requirements.txt which contains the libraries that you want to install for ex:

numpy==1.14.2
Pillow==5.1.0

您将位于您的文件夹中,该文件夹中requirements.txt在我的情况下,我的项目路径为

You gonna situate in your folder which contains that requirements.txt in my case the path to my project is

C:\Users\LE\Desktop\Projet2_Sig_Exo3\exo 3\k-means

现在只需输入

python -m pip install -r ./requirements.txt

以及您要安装的所有库文件

and all the libararies that you want gonna install

C:\Users\LE\Desktop\Projet2_Sig_Exo3\exo 3\k-means>python -m pip install -r ./requirements.txt

这篇关于如何在Python(3.5.1)中添加/使用库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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