win10 64位下Python中NLTK,pip,numpy等安装方法

win64下Python中NLTK的安装方法

Python已经更新至3.6版本,但是2.7.3的版本也足以使用。但是win64版本之下却没有Python中NLTK的安装包,网络之上的NLTK安装方法也有很多,本人也是演过很多种,很明显,都不成功,于是写下这个

一.安装Python
1.首先Python官网下载python-2.7.3.amd64.msi这个文件。安装之后就要使用了。
会有如下问题
这里写图片描述
按照网上的方法,你需要设置路径。方法如下:右键:我的电脑–>属性–>高级系统设置–>环境变量,
2.Python安装在D:\Program Files\Python

设置环境变量:()

Path 中增加 D:\Program Files\Python;D:\Program Files\Python\Scripts;

Pathext 中增加 .PY;.PYM;

这时在cmd中测试 python 安装成功(引用自http://www.xuebuyuan.com/1490918.html 博文)

当然,这个方法对于我来说是不成功的

方法二,
C:\Users\yyiyiyi>set PATH=%PATH%;D:\Python27;;
C:\Users\yyiyiyi>这部分在cmd本来就有的,只需要后面的,不同目录分号隔开,后面安装pip的时候也会遇到
这个时候已经成功

第一步已经完成了(可以参考http://blog.sina.com.cn/s/blog_6d65717d010176er.html
二. Win10 64位 python easy_install 的安装

32位有直接安装包,但是64位的需要ez_setup.py安装,下载ez_setup.py后,进入文件所在目录,>python ez_setup.py 顺利的话就安装好了,可以在D:\Program
Files\Python\Scripts 下看见easy_install.exe 文件了,这时从cmd下进入Scripts目录,就可以运行easy_install XXX 了。如果想设置环境变量也可以,在Path中添加即可,但如果用的不多 ,没必要吧。

参考 http://www.cnblogs.com/zhuyp1015/archive/2012/07/17/2596495.html (这个里面给出的ez_setup是不全的。。。)
给出一个全的代码(有点长,复制的时候注意)

#!/usr/bin/env python

"""
Setuptools bootstrapping installer.

Maintained at https://github.com/pypa/setuptools/tree/bootstrap.

Run this script to install or upgrade setuptools.

This method is DEPRECATED. Check https://github.com/pypa/setuptools/issues/581 for more details.
"""

import os
import shutil
import sys
import tempfile
import zipfile
import optparse
import subprocess
import platform
import textwrap
import contextlib

from distutils import log

try:
    from urllib.request import urlopen
except ImportError:
    from urllib2 import urlopen

try:
    from site import USER_SITE
except ImportError:
    USER_SITE = None

# 33.1.1 is the last version that supports setuptools self upgrade/installation.
DEFAULT_VERSION = "33.1.1"
DEFAULT_URL = "https://pypi.io/packages/source/s/setuptools/"
DEFAULT_SAVE_DIR = os.curdir
DEFAULT_DEPRECATION_MESSAGE = "ez_setup.py is deprecated and when using it setuptools will be pinned to {0} since it's the last version that supports setuptools self upgrade/installation, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools"

MEANINGFUL_INVALID_ZIP_ERR_MSG = 'Maybe {0} is corrupted, delete it and try again.'

log.warn(DEFAULT_DEPRECATION_MESSAGE.format(DEFAULT_VERSION))


def _python_cmd(*args):
    """
    Execute a command.

    Return True if the command succeeded.
    """
    args = (sys.executable,) + args
    return subprocess.call(args) == 0


def _install(archive_filename, install_args=()):
    """Install Setuptools."""
    with archive_context(archive_filename):
        # installing
        log.warn('Installing Setuptools')
        if not _python_cmd('setup.py', 'install', *install_args):
            log.warn('Something went wrong during the installation.')
            log.warn('See the error message above.')
            # exitcode will be 2
            return 2
  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值