pip install error:ModuleNotFoundError没有名为' setuptools'

时间:2017-03-31 17:08:35

标签: python django python-3.6 virtualenvwrapper

当我在PowerShell控制台中运行pip install virtualenvwrapper-win时,出现错误:

  

PS C:\ Windows \ system32> pip install virtualenvwrapper-win   收集virtualenvwrapper-win     使用缓存的virtualenvwrapper-win-1.2.1.zip       从命令python setup.py egg_info完成输出:       Traceback(最近一次调用最后一次):         文件"",第1行,in       ModuleNotFoundError:没有名为' setuptools'

的模块      

命令" python setup.py egg_info"

中的错误代码1失败

我已尝试执行pip install setuptools并尝试卸载并重新安装和更新,但错误仍然存​​在。

pippython个可执行文件已添加到环境变量中。

2 个答案:

答案 0 :(得分:1)

尝试从此处下载ZIP存档,手动安装virtualenvwrapper-win模块: https://pypi.python.org/pypi/virtualenvwrapper-win

  • 在PowerShell控制台中,转到存档下载到的目录(我的目的地为C:\Users\user\Downloads\)并运行此目录以解压缩存档:Expand-Archive .\virtualenvwrapper-win-1.2.1.zip

  • 仍然在PowerShell和上面的同一目录中,运行:cd .\virtualenvwrapper-win-1.2.1\virtualenvwrapper-win-1.2.1\

  • 接下来,运行:python setup.py install

如果一切顺利,你应该看到这样的事情:

    PS C:\Users\user\Downloads\virtualenvwrapper-win-1.2.1\virtualenvwrapper-win-1.2.1> python .\setup.py install
    running install
    running bdist_egg
    running egg_info
    writing virtualenvwrapper_win.egg-info\PKG-INFO
    writing dependency_links to virtualenvwrapper_win.egg-info\dependency_links.txt
    writing requirements to virtualenvwrapper_win.egg-info\requires.txt
    writing top-level names to virtualenvwrapper_win.egg-info\top_level.txt
    reading manifest file 'virtualenvwrapper_win.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'virtualenvwrapper_win.egg-info\SOURCES.txt'
    installing library code to build\bdist.win-amd64\egg
    running install_lib
    warning: install_lib: 'build\lib' does not exist -- no Python modules to install

    creating build
    creating build\bdist.win-amd64
    creating build\bdist.win-amd64\egg
    creating build\bdist.win-amd64\egg\EGG-INFO
    installing scripts to build\bdist.win-amd64\egg\EGG-INFO\scripts
    running install_scripts
    running build_scripts
    creating build\scripts-3.6
    copying scripts\add2virtualenv.bat -> build\scripts-3.6
    copying scripts\cd-.bat -> build\scripts-3.6
    copying scripts\cdproject.bat -> build\scripts-3.6
    copying scripts\cdsitepackages.bat -> build\scripts-3.6
    copying scripts\cdvirtualenv.bat -> build\scripts-3.6
    copying scripts\folder_delete.bat -> build\scripts-3.6
    copying scripts\lssitepackages.bat -> build\scripts-3.6
    copying scripts\lsvirtualenv.bat -> build\scripts-3.6
    copying scripts\mkvirtualenv.bat -> build\scripts-3.6
    copying scripts\rmvirtualenv.bat -> build\scripts-3.6
    copying scripts\setprojectdir.bat -> build\scripts-3.6
    copying scripts\toggleglobalsitepackages.bat -> build\scripts-3.6
    copying scripts\whereis.bat -> build\scripts-3.6
    copying scripts\workon.bat -> build\scripts-3.6
    creating build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\add2virtualenv.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\cd-.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\cdproject.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\cdsitepackages.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\cdvirtualenv.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\folder_delete.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\lssitepackages.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\lsvirtualenv.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\mkvirtualenv.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\rmvirtualenv.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\setprojectdir.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\toggleglobalsitepackages.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\whereis.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying build\scripts-3.6\workon.bat -> build\bdist.win-amd64\egg\EGG-INFO\scripts
    copying virtualenvwrapper_win.egg-info\PKG-INFO -> build\bdist.win-amd64\egg\EGG-INFO
    copying virtualenvwrapper_win.egg-info\SOURCES.txt -> build\bdist.win-amd64\egg\EGG-INFO
    copying virtualenvwrapper_win.egg-info\dependency_links.txt -> build\bdist.win-amd64\egg\EGG-INFO
    copying virtualenvwrapper_win.egg-info\not-zip-safe -> build\bdist.win-amd64\egg\EGG-INFO
    copying virtualenvwrapper_win.egg-info\requires.txt -> build\bdist.win-amd64\egg\EGG-INFO
    copying virtualenvwrapper_win.egg-info\top_level.txt -> build\bdist.win-amd64\egg\EGG-INFO
    creating dist
    creating 'dist\virtualenvwrapper_win-1.2.1-py3.6.egg' and adding 'build\bdist.win-amd64\egg' to it
    removing 'build\bdist.win-amd64\egg' (and everything under it)
    Processing virtualenvwrapper_win-1.2.1-py3.6.egg
    creating c:\users\user\appdata\local\programs\python\python36\lib\site-packages\virtualenvwrapper_win-1.2.1-py3.6.egg
    Extracting virtualenvwrapper_win-1.2.1-py3.6.egg to c:\users\user\appdata\local\programs\python\python36\lib\site-packages
    Adding virtualenvwrapper-win 1.2.1 to easy-install.pth file
    Installing add2virtualenv.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing cd-.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing cdproject.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing cdsitepackages.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing cdvirtualenv.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing folder_delete.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing lssitepackages.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing lsvirtualenv.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing mkvirtualenv.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing rmvirtualenv.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing setprojectdir.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing toggleglobalsitepackages.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing whereis.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing workon.bat script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts

    Installed c:\users\user\appdata\local\programs\python\python36\lib\site-packages\virtualenvwrapper_win-1.2.1-py3.6.egg
    Processing dependencies for virtualenvwrapper-win==1.2.1
    Searching for virtualenv==15.1.0
    Best match: virtualenv 15.1.0
    Adding virtualenv 15.1.0 to easy-install.pth file
    Installing virtualenv-script.py script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts
    Installing virtualenv.exe script to C:\Users\user\AppData\Local\Programs\Python\Python36\Scripts

    Using c:\users\user\appdata\local\programs\python\python36\lib\site-packages
    Finished processing dependencies for virtualenvwrapper-win==1.2.1

答案 1 :(得分:1)

virtualenvwrapper-win仅适用于DOS cmd.exe。来自自述文件:

  

这些脚本适用于任何版本的Windows(Windows XP,Windows Vista,Windows 7/8/10)。

     

但是,它们只能在常规命令提示符中使用。他们不会在Powershell中工作。还有其他针对Powershell的virtualenvwrapper项目。