问题描述
这个问题,我在尝试用 pypi 安装包 netstat 时遇到了
this problem, I have when try install package netstat with pypi
[opmeitle@localhost ~]$ sudo pip install netstat
[sudo] password for opmeitle:
Downloading/unpacking netstat
Running setup.py egg_info for package netstat
file nester_g:.py (for module nester_g:) not found
Installing collected packages: netstat
Running setup.py install for netstat
file nester_g:.py (for module nester_g:) not found
file nester_g:.py (for module nester_g:) not found
warning: install_lib: 'build/lib' does not exist -- no Python modules to install
file nester_g:.py (for module nester_g:) not found
file nester_g:.py (for module nester_g:) not found
Successfully installed netstat
Cleaning up...
以及其他问题:如何在python2.7而不是3中安装包?
and other question: how to install packages in python2.7 and not in 3?
推荐答案
虽然 Kugel 的回答 是完全有效的,但我会还敦促您避免系统范围的安装,并使用 virtualenv.它将允许您为您的项目创建一个沙箱并将其与其他人隔离.
While Kugel's answer is perfectly valid, I would also urge you to avoid system wide install, and to use a virtualenv.It will allow you to create a sandbox for your project and isolate it from others.
创建 virtualenv 时,您可以指定要使用的 Python 解释器版本.例如,对于python2.7:
When creating a virtualenv, you can specify the Python interpreter version you want to use. For example, for python2.7:
$ virtualenv path/to/project -p /usr/bin/python2.7
然后,一个pip install
命令会自动安装python2.7的包.
Then, a pip install
command will automatically install the package for python2.7.
这篇关于如何在python 2.7中使用pypi安装包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!