日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python import random 报错_Python import random报错处理办法

發(fā)布時間:2023/12/19 python 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python import random 报错_Python import random报错处理办法 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

python安裝失敗:make的時候報錯:

/usr/include/tkDecls.h:1542: error: expected ‘)’ before ‘*’ token

/usr/include/tkDecls.h:1639: error: expected declaration specifiers or ‘...’ before ‘Drawable’

/usr/include/tkDecls.h:1674: error: expected ‘)’ before ‘*’ token

/usr/include/tkDecls.h:1679: error: expected ‘)’ before ‘*’ token

/usr/include/tkDecls.h:1710: error: expected specifier-qualifier-list before ‘XColor’

Failed to find the necessary bits to build these modules:

bsddb185 dl imageop

sunaudiodev

To find the necessary bits, look in setup.py in detect_modules() for the module's name.

Failed to build these modules:

_tkinter binascii zlib

上述錯誤,導致的結果是:

[storm@bs035 rpm]$ python

Python 2.6.6 (r266:84292, Apr 12 2016, 18:51:29)

[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import random

Traceback (most recent call last):

File "", line 1, in

File "/usr/local/lib/python2.6/random.py", line 48, in

from binascii import hexlify as _hexlify

ImportError: No module named binascii

>>>

解決辦法

python版本不正常導致的。

升級安裝zlib

# wget

http://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz

# tar -zxvf zlib-1.2.8.tar.gz

# cd zlib-1.2.8

# ./configure

# make install

升級安裝sqlite3

# cd ..

# wget

http://www.sqlite.org/2014/sqlite-autoconf-3080500.tar.gz

# tar -zxvf sqlite-autoconf-3080500.tar.gz

# cd sqlite-autoconf-3080500

# ./configure

# make

# make install

# cd ../Python-2.7.3

# make –s

# make && sudo make install

MD,之前可能刪過linux自帶的rpm包。

血淋淋的教訓啊,搞這個東東,搞了接近一天(先是一個個找rpm包,然后又按照正常的機器上裝的rpm包重新下了一遍)。。。

感謝原文的分享啊,不然還不知道要糾結多久。

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎

總結

以上是生活随笔為你收集整理的python import random 报错_Python import random报错处理办法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。