Windows 7에 Python Steem 라이브러리 설치 성공(pycrypto 오류 해결)

in #kr6 years ago

오랜만에 개발관련 포스팅을 남겨봅니다.

그동안에 아래 URL들을 통해서 윈도우에 Python을 설치하고 steem라이브러리를 설치하려고 많은 시도를 하였습니다. ㅠㅠ

kr-dev#1. @asbear님의 "비개발자가 steemit 주무르기(1)" 직접 따라가 봅니다~ — Steemit
https://steemit.com/kr/@skt1/kr-dev-1-asbear-steemit-1

kr-dev#1. 개발자가 steemit 주무르기(1) / windows10 with python (by @skt1) — Steemit
https://steemit.com/kr/@idas4you/kr-dev-1-steemit-1-windows10-with-python-by-skt1

steem API로 자동 보팅 봇 만들어보기 with Python — Steemit
https://steemit.com/kr-dev/@tmkor/steem-api-with-python

하지만 위의 글에서도 마찬가지로 꼭 문제가 생기기 마련이더라구요~

제일 골머리 썩은게 steem 라이브러리 설치시에 PyCrypto에서 발생하는 오류 ㅠㅠ

그래서 파이썬 버전까지 바꾸어가면서 삽질을 한 경우를 공유합니다.

=============================================================================

ㅁ Python 설치 : https://www.python.org/downloads/
Python 2.7.15 설치함

ㅁ Visual Stdio 빌드툴 설치 : https://www.visualstudio.com/ko/downloads/?rr=http%3A%2F%2Flandinghub.visualstudio.com%2Fvisual-cpp-build-tools
Visual Stdio Community 2017 설치함.

ㅁ Steem-Python 설치함 : http://steem.readthedocs.io/en/latest/install.html
$ pip install -U steem

이때부터 pycrypto 오류가 발생함... 아우~~~ 정말 미쳐버려~
시간날때마다 찾아보니 아래의 사이트 발견 와우~

ㅁ PyCrypto (Prebuilt Python Binaries for Windows) 설치 :
http://www.voidspace.org.uk/python/modules.shtml#pycrypto

이후에 다시 Steem 설치하였으나 ㅠㅠ
아래와 같이 'ujson' 오류 아....

C:\Users\Ahn\steem-python>pip install -U steem
Collecting steem
Using cached https://files.pythonhosted.org/packages/f8/cb/78489bf60c7c0212e5f
65ecc04877b5a82f896fc3c84e2c0331c07c71552/steem-1.0.1-py2.py3-none-any.whl
Requirement not upgraded as not directly required: scrypt>=0.8.0 in c:\python27
lib\site-packages (from steem) (0.8.6)
Requirement not upgraded as not directly required: toolz in c:\python27\lib\site
-packages (from steem) (0.9.0)
Requirement not upgraded as not directly required: urllib3 in c:\python27\lib\si
te-packages (from steem) (1.22)
Requirement not upgraded as not directly required: langdetect in c:\python27\lib
\site-packages (from steem) (1.0.7)
Requirement not upgraded as not directly required: funcy in c:\python27\lib\site
-packages (from steem) (1.10.2)
Requirement not upgraded as not directly required: prettytable in c:\python27\li
b\site-packages (from steem) (0.7.2)
Requirement not upgraded as not directly required: futures; python_version < "3.
0.0" in c:\python27\lib\site-packages (from steem) (3.2.0)
Requirement not upgraded as not directly required: w3lib in c:\python27\lib\site
-packages (from steem) (1.19.0)
Collecting ujson (from steem)
Using cached https://files.pythonhosted.org/packages/16/c4/79f3409bc7105590154
64e5f49b9879430d8f87498ecdc335899732e5377/ujson-1.35.tar.gz
Collecting ecdsa>=0.13 (from steem)
Using cached https://files.pythonhosted.org/packages/63/f4/73669d51825516ce8c4
3b816c0a6b64cd6eb71d08b99820c00792cb42222/ecdsa-0.13-py2.py3-none-any.whl
Collecting voluptuous (from steem)
Using cached https://files.pythonhosted.org/packages/f5/09/a0e20a0bd743131e237
128bad3a4f83b283f70c032b7e7c0f06baf7f6862/voluptuous-0.11.1-py2.py3-none-any.whl

Collecting certifi (from steem)
Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975
fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl

Requirement not upgraded as not directly required: pycrypto>=1.9.1 in c:\python2
7\lib\site-packages (from steem) (2.6)
Collecting pylibscrypt>=1.6.1 (from steem)
Collecting appdirs (from steem)
Using cached https://files.pythonhosted.org/packages/56/eb/810e700ed1349edde4c
bdc1b2a21e28cdf115f9faf263f6bbf8447c1abf3/appdirs-1.4.3-py2.py3-none-any.whl
Collecting future (from steem)
Requirement not upgraded as not directly required: six in c:\python27\lib\site-p
ackages (from langdetect->steem) (1.11.0)
Building wheels for collected packages: ujson
Running setup.py bdist_wheel for ujson ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools,
tokenize;file='c:\users\ahn\appdata\local\temp\pip-install-ysyurj\ujs
on\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace(
'\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d c:
\users\ahn\appdata\local\temp\pip-wheel-gkk1gs --python-tag cp27:
running bdist_wheel
running build
running build_ext
building 'ujson' extension
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpytho
n27


Failed building wheel for ujson
Running setup.py clean for ujson
Failed to build ujson
Installing collected packages: ujson, ecdsa, voluptuous, certifi, pylibscrypt, a
ppdirs, future, steem
Running setup.py install for ujson ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools
, tokenize;file='c:\users\ahn\appdata\local\temp\pip-install-ysyurj\u
json\setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replac
e('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --recor
d c:\users\ahn\appdata\local\temp\pip-record-oog7na\install-record.txt --single-
version-externally-managed --compile:
running install
running build
running build_ext
building 'ujson' extension
error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpyt
hon27

----------------------------------------

Command "c:\python27\python.exe -u -c "import setuptools, tokenize;file='c:
\users\ahn\appdata\local\temp\pip-install-ysyurj\ujson\setup.py';f=getatt
r(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close(
);exec(compile(code, file, 'exec'))" install --record c:\users\ahn\appdata\l
ocal\temp\pip-record-oog7na\install-record.txt --single-version-externally-manag
ed --compile" failed with error code 1 in c:\users\ahn\appdata\local\temp\pip-in
stall-ysyurj\ujson\

해당 버전의 Visual C++ 9.0에서는 필요한것이 있다고 함. 위의 url을 알려줌
위의 URL 치고 들어가면 아래와 같은 사이트가 보이고 해당 필요한 것 다운로드 하여 설치함

ㅁ Visual C++ Compiler for Python 2.7 설치 함 : https://www.microsoft.com/en-us/download/confirmation.aspx?id=44266

아래와 같이 ujson 설치 함

C:\Users\Ahn\steem-python>pip install ujson
Collecting ujson
Using cached https://files.pythonhosted.org/packages/16/c4/79f3409bc7105590154
64e5f49b9879430d8f87498ecdc335899732e5377/ujson-1.35.tar.gz
Building wheels for collected packages: ujson
Running setup.py bdist_wheel for ujson ... done
Stored in directory: C:\Users\Ahn\AppData\Local\pip\Cache\wheels\28\77\e4\0311
145b9c2e2f01470e744855131f9e34d6919687550f87d1
Successfully built ujson
Installing collected packages: ujson
Successfully installed ujson-1.35

=====================================================================================
와우~~~ 최종 설치 완료~~~ 나나나나나~~~

C:\Users\Ahn\steem-python>pip install -U steem
Collecting steem
Using cached https://files.pythonhosted.org/packages/f8/cb/78489bf60c7c0212e5f
65ecc04877b5a82f896fc3c84e2c0331c07c71552/steem-1.0.1-py2.py3-none-any.whl
Requirement not upgraded as not directly required: scrypt>=0.8.0 in c:\python27
lib\site-packages (from steem) (0.8.6)
Requirement not upgraded as not directly required: toolz in c:\python27\lib\site
-packages (from steem) (0.9.0)
Requirement not upgraded as not directly required: urllib3 in c:\python27\lib\si
te-packages (from steem) (1.22)
Requirement not upgraded as not directly required: langdetect in c:\python27\lib
\site-packages (from steem) (1.0.7)
Requirement not upgraded as not directly required: funcy in c:\python27\lib\site
-packages (from steem) (1.10.2)
Requirement not upgraded as not directly required: prettytable in c:\python27\li
b\site-packages (from steem) (0.7.2)
Requirement not upgraded as not directly required: futures; python_version < "3.
0.0" in c:\python27\lib\site-packages (from steem) (3.2.0)
Requirement not upgraded as not directly required: w3lib in c:\python27\lib\site
-packages (from steem) (1.19.0)
Requirement not upgraded as not directly required: ujson in c:\python27\lib\site
-packages (from steem) (1.35)
Collecting ecdsa>=0.13 (from steem)
Using cached https://files.pythonhosted.org/packages/63/f4/73669d51825516ce8c4
3b816c0a6b64cd6eb71d08b99820c00792cb42222/ecdsa-0.13-py2.py3-none-any.whl
Collecting voluptuous (from steem)
Using cached https://files.pythonhosted.org/packages/f5/09/a0e20a0bd743131e237
128bad3a4f83b283f70c032b7e7c0f06baf7f6862/voluptuous-0.11.1-py2.py3-none-any.whl

Collecting certifi (from steem)
Using cached https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975
fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl

Requirement not upgraded as not directly required: pycrypto>=1.9.1 in c:\python2
7\lib\site-packages (from steem) (2.6)
Collecting pylibscrypt>=1.6.1 (from steem)
Collecting appdirs (from steem)
Using cached https://files.pythonhosted.org/packages/56/eb/810e700ed1349edde4c
bdc1b2a21e28cdf115f9faf263f6bbf8447c1abf3/appdirs-1.4.3-py2.py3-none-any.whl
Collecting future (from steem)
Requirement not upgraded as not directly required: six in c:\python27\lib\site-p
ackages (from langdetect->steem) (1.11.0)
Installing collected packages: ecdsa, voluptuous, certifi, pylibscrypt, appdirs,
future, steem
Successfully installed appdirs-1.4.3 certifi-2018.4.16 ecdsa-0.13 future-0.16.0
pylibscrypt-1.7.1 steem-1.0.1 voluptuous-0.11.1

========================================================================
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

from steem.blog import Blog
blog = Blog("capslock")
post = next(blog)
Traceback (most recent call last):
File line 1, in
TypeError: instance has no next() method

일단 steem 라이브러리를 import하는것 까지는 성공하는데
위의 오류는 또 찾아봐야겠습니다.

Sort:  

전철에서 보니 어지러워요
집에서 다시 집중해서 봐야 겠어요
즐거운 하루되세요🍀

Congratulations @capslock! You have received a personal award!

1 Year on Steemit
Click on the badge to view your Board of Honor.

Do not miss the last post from @steemitboard:
SteemitBoard World Cup Contest - Round of 16 - Day 4


Participate in the SteemitBoard World Cup Contest!
Collect World Cup badges and win free SBD
Support the Gold Sponsors of the contest: @good-karma and @lukestokes


Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @capslock! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You got more than 1000 replies. Your next target is to reach 1250 replies.

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Meet the Steemians Contest - The results, the winners and the prizes
Meet the Steemians Contest - Special attendees revealed

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @capslock! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You made more than 300 comments. Your next target is to reach 400 comments.

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @capslock! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You got more than 1250 replies. Your next target is to reach 1500 replies.

Click here to view your Board of Honor
If you no longer want to receive notifications, reply to this comment with the word STOP

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @capslock! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You got more than 1500 replies. Your next target is to reach 1750 replies.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Christmas Challenge - The party continues
Christmas Challenge - Send a gift to to your friends

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @capslock! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You got more than 1750 replies. Your next target is to reach 2000 replies.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

Christmas Challenge - The party continues

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @capslock! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You got more than 2000 replies. Your next target is to reach 2250 replies.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @capslock! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You got more than 2500 replies. Your next target is to reach 2750 replies.

Click here to view your Board
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

SteemWhales has officially moved to SteemitBoard Ranking
SteemitBoard - Witness Update

Support SteemitBoard's project! Vote for its witness and get one more award!

Congratulations @capslock! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.16
TRX 0.15
JST 0.028
BTC 54370.47
ETH 2283.51
USDT 1.00
SBD 2.33