Skip to content

Instantly share code, notes, and snippets.

@kashewnuts
Last active May 18, 2016 16:26
Show Gist options
  • Save kashewnuts/dbe6dbf268eebed70695ce04aae4350f to your computer and use it in GitHub Desktop.
Save kashewnuts/dbe6dbf268eebed70695ce04aae4350f to your computer and use it in GitHub Desktop.
# sys.path確認
> python
Python 2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys;print sys.path
['', 'C:\\WINDOWS\\SYSTEM32\\python27.zip', 'C:\\Python\\27\\DLLs', 'C:\\Python\\27\\lib', 'C:\\Python\\27\\lib\\plat-win', 'C:\\Python\\27\\lib\\lib-tk', 'C:\\Python\\27', 'C:\\Python\\27\\lib\\site-packages', 'C:\\Python\\27\\lib\\site-packages\\win32', 'C:\\Python\\27\\lib\\site-packages\\win32\\lib', 'C:\\Python\\27\\lib\\site-packages\\Pythonwin']
# 実行時エラー内容
> rst2html.py --version
Traceback (most recent call last):
File "C:\Python\27\Scripts\rst2html.py", line 17, in <module>
from docutils.core import publish_cmdline, default_description
ImportError: No module named docutils.core
# 関連付け確認
C:\Users\KashunYoshida>head test.py
# -*- coding: utf-8 -*-
import sys
print(sys.executable)
C:\Users\KashunYoshida>python test.py
C:\Python\27\python.exe
@kashewnuts
Copy link
Author

現象

インタラクティブシェルやVimのjedi-vimプラグインではインポートされるが、コマンドプロンプトから起動できない。

環境

  • Windows10 Pro(64bit)
  • Python2.7.10

@kashewnuts
Copy link
Author

対応

$python test.py でなく、 $test.py で実行したら C:\Users\KashunYoshida\.virtualenvs\test\Scripts\python.exe とvirtualenvのpythonを見ていたので、以下の内容を実施して修正した。

  • deactivateコマンド実行
  • test.pyの右クリックのメニューから関連付けを修正

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment