解决安装python第三方模块,python第三方库安装

发布时间:2022-11-22

本文目录一览:

  1. [【Python入门】37.常用第三方模块之 创建虚拟环境virtualenv](#【Python入门】37.常用第三方模块之 创建虚拟环境virtualenv)
  2. [关于python第三方模块 求指教](#关于python第三方模块 求指教)
  3. [怎么安装python 第三方模块](#怎么安装python 第三方模块)
  4. [python 第三方库怎么安装](#python 第三方库怎么安装)
  5. 如何安装python的第三方模块

【Python入门】37.常用第三方模块之 创建虚拟环境virtualenv

摘要:virtualenv可创建独立的虚拟运行环境,解决了不同应用项目间多版本的不兼容问题。

常用第三方模块

  • virtualenv

virtualenv

安装virtualenv

在命令行模式下输入:

等待安装成功即可。

创建虚拟环境

首先通过cd命令进入需要创建虚拟环境的文件目录,如在D盘的envs文件夹里面:

然后通过 virtualenv 创建一个虚拟环境,我们将它命名为 new_env

然后会看到下面结果:

说明成功使用当前系统的Python版本创建了一个虚拟环境。

使用virtualenv

通过cd命令进入虚拟环境目录下的Scripts目录:

然后输入 activate

会出现下面的结果:

地址前面的括号表示,当前环境是Python创建的虚拟环境 new_env 。

输入python,可查看当前环境的Python版本。 输入pip list,可查看当前环境下包含的库的版本。 在虚拟环境下,用pip安装的所有包都会装在new_env环境下,系统Python环境不受影响。这样,我们就可以安装运行项目所需要的工具版本了。 最后,使用deactivate命令退出虚拟环境。 virtualenv可创建独立的虚拟运行环境,解决了不同应用项目间多版本的不兼容问题。 以上就是本节的全部内容,感谢你的阅读。 下一节内容:图形界面 有任何问题与想法,欢迎评论与吐槽。 和博主一起学习Python吧( ̄▽ ̄)~*

关于python第三方模块 求指教

你先从python的安装开始检查,或者重装python; 安装的时候在第一个页面把 □add path勾上,默认添加环境变量,可能是你没有添加。 安装的时候尽量用国内的镜像源,可以先升级pip指令,然后要切换到安装python的目录下,我这边是安装在C盘的根目录所以写 cd c:\ 回车后加上指令。

  1. python -m pip install --upgrade pip -i --trusted-host pypi.douban.com
  2. 切换为C盘根目录:pip install -i pillow
cd c:\ pip install -i   pillow

看看你编写代码的工具里面有没有导入库,如果还不行就是你工具的原因。 工具你可以使用wing pro,vscode,aptana 三选一,体量小,方便使用。 还有不懂你再追问。

怎么安装python 第三方模块

方法1:下载源码,手动运行setup.py install去安装。下载对应的源码,往往都是tar.gz,zip的压缩包,解压后,打开windows的cmd,切换到对应目录,运行:

setup.py install

即可去安装。 方法2:利用第三方安装工具(如pip,easy_install,distr)

python 第三方库怎么安装

【方法一】: 通过setuptools来安装python模块

首先下载 NOTE: 最好下载个setuptools,本人是15.2版本,里面包含了ez_setup 运行:

python ez_setup.py

输出示例:

D:\work\installation\setuptools-15.2\setuptools-15.2python ez_setup.py 1.txt
Extracting in c:\users\admini~1\appdata\local\temp\tmpbxikxf
Now working in c:\users\admini~1\appdata\local\temp\tmpbxikxf\setuptools-15.2
Installing Setuptools
......
Copying setuptools-15.2-py2.7.egg to c:\python27\lib\site-packages
setuptools 15.2 is already the active version in easy-install.pth
Installing easy_install-script.py script to C:\Python27\Scripts
Installing easy_install.exe script to C:\Python27\Scripts
Installing easy_install-2.7-script.py script to C:\Python27\Scripts
Installing easy_install-2.7.exe script to C:\Python27\Scripts
Installed c:\python27\lib\site-packages\setuptools-15.2-py2.7.egg
Processing dependencies for setuptools==15.2
Finished processing dependencies for setuptools==15.2

运行:

easy_install py

输出示例:

D:\workeasy_install py #py 为第三方库文件
Searching for py
Best match: py 1.4.26
Adding py 1.4.26 to easy-install.pth file
Using c:\python27\lib\site-packages
Processing dependencies for py
Finished processing dependencies for py

【方法二】: 通过pip来安装python模块

安装:

easy_install pip

输出示例:

D:\workeasy_install pip
Searching for pip
Best match: pip 6.1.1
Processing pip-6.1.1-py2.7.egg
pip 6.1.1 is already the active version in easy-install.pth
Installing pip-script.py script to C:\Python27\Scripts
Installing pip.exe script to C:\Python27\Scripts
Installing pip2.7-script.py script to C:\Python27\Scripts
Installing pip2.7.exe script to C:\Python27\Scripts
Installing pip2-script.py script to C:\Python27\Scripts
Installing pip2.exe script to C:\Python27\Scripts
Using c:\python27\lib\site-packages\pip-6.1.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

运行:

pip install xlrd

Usage:

pip command [options]

Commands:

  • install Install packages.
  • uninstall Uninstall packages.
  • freeze Output installed packages in requirements format.
  • list List installed packages.
  • show Show information about installed packages.
  • search Search PyPI for packages.
  • wheel Build wheels from your requirements.
  • zip DEPRECATED. Zip individual packages.
  • unzip DEPRECATED. Unzip individual packages.
  • help Show help for commands. General Options:
  • -h, --help Show help.
  • --isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
  • -v, --verbose Give more output. Option is additive, and can be used up to 3 times.
  • -V, --version Show version and exit.
  • -q, --quiet Give less output.
  • --log path Path to a verbose appending log.
  • --proxy proxy Specify a proxy in the form [user:passwd@]proxy.server:port.
  • --retries retries Maximum number of retries each connection should attempt (default 5 times).
  • --timeout sec Set the socket timeout (default 15 seconds).
  • --exists-action action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
  • --trusted-host hostname Mark this host as trusted, even though it does not have valid or any HTTPS.
  • --cert path Path to alternate CA bundle.
  • --client-cert path Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
  • --cache-dir dir Store the cache data in dir.
  • --no-cache-dir Disable the cache.
  • --disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.

【方法三】:直接从网上下载下可执行文件来安装.

比如说,去 pythonlibs 网站,提供了很多Python非官方包下载,二进制文件,下载安装方便.

如何安装python的第三方模块

通过pip来安装python模块

安装:

easy_install pip

输出示例:

D:\workeasy_install pip
Searching for pip
Best match: pip 6.1.1
Processing pip-6.1.1-py2.7.egg
pip 6.1.1 is already the active version in easy-install.pth
Installing pip-script.py script to C:\Python27\Scripts
Installing pip.exe script to C:\Python27\Scripts
Installing pip2.7-script.py script to C:\Python27\Scripts
Installing pip2.7.exe script to C:\Python27\Scripts
Installing pip2-script.py script to C:\Python27\Scripts
Installing pip2.exe script to C:\Python27\Scripts
Using c:\python27\lib\site-packages\pip-6.1.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

运行:

pip install xlrd

Usage:

pip command [options]

Commands:

  • install Install packages.
  • uninstall Uninstall packages.
  • freeze Output installed packages in requirements format.
  • list List installed packages.
  • show Show information about installed packages.
  • search Search PyPI for packages.
  • wheel Build wheels from your requirements.
  • zip DEPRECATED. Zip individual packages.
  • unzip DEPRECATED. Unzip individual packages.
  • help Show help for commands. General Options:
  • -h, --help Show help.
  • --isolated Run pip in an isolated mode, ignoring environment variables and user configuration.
  • -v, --verbose Give more output. Option is additive, and can be used up to 3 times.
  • -V, --version Show version and exit.
  • -q, --quiet Give less output.
  • --log path Path to a verbose appending log.
  • --proxy proxy Specify a proxy in the form [user:passwd@]proxy.server:port.
  • --retries retries Maximum number of retries each connection should attempt (default 5 times).
  • --timeout sec Set the socket timeout (default 15 seconds).
  • --exists-action action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.
  • --trusted-host hostname Mark this host as trusted, even though it does not have valid or any HTTPS.
  • --cert path Path to alternate CA bundle.
  • --client-cert path Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.
  • --cache-dir dir Store the cache data in dir.
  • --no-cache-dir Disable the cache.
  • --disable-pip-version-check Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.