2017-03-14 10 views
2

pythonでプラットフォームに依存するライブラリに が見つかりませんでした https://docs.python.org/3/using/cmdline.html#environment-variables)一般的に私はPYTHONHOME変数を設定する必要はありません(私はそれを設定したくありません)。 は、私はソースからコンパイルとPython 3.6をインストールし、私はコンソールでpython3.6を入力するときに私が取得している3.6.1

他のPythonバージョン(2.7と3.4)も問題なくインストールしました。

私はplatform dependent librariesすることにより、これらのようなのpythonをロードする共有オブジェクト・ライブラリを理解する:

$ ls /usr/lib/python3.6/ | grep .so 
array.cpython-36m-arm-linux-gnueabihf.so 
_asyncio.cpython-36m-arm-linux-gnueabihf.so 
audioop.cpython-36m-arm-linux-gnueabihf.so 
binascii.cpython-36m-arm-linux-gnueabihf.so 
_bisect.cpython-36m-arm-linux-gnueabihf.so 
_blake2.cpython-36m-arm-linux-gnueabihf.so 
cmath.cpython-36m-arm-linux-gnueabihf.so 
_codecs_cn.cpython-36m-arm-linux-gnueabihf.so 
_codecs_hk.cpython-36m-arm-linux-gnueabihf.so 
_codecs_iso2022.cpython-36m-arm-linux-gnueabihf.so 
_codecs_jp.cpython-36m-arm-linux-gnueabihf.so 
_codecs_kr.cpython-36m-arm-linux-gnueabihf.so 
_codecs_tw.cpython-36m-arm-linux-gnueabihf.so 
_crypt.cpython-36m-arm-linux-gnueabihf.so 
_csv.cpython-36m-arm-linux-gnueabihf.so 
_ctypes.cpython-36m-arm-linux-gnueabihf.so 
_ctypes_test.cpython-36m-arm-linux-gnueabihf.so 
cv2.cpython-36m-arm-linux-gnueabihf.so 
_datetime.cpython-36m-arm-linux-gnueabihf.so 
_decimal.cpython-36m-arm-linux-gnueabihf.so 
_elementtree.cpython-36m-arm-linux-gnueabihf.so 
fcntl.cpython-36m-arm-linux-gnueabihf.so 
grp.cpython-36m-arm-linux-gnueabihf.so 
_hashlib.cpython-36m-arm-linux-gnueabihf.so 
_heapq.cpython-36m-arm-linux-gnueabihf.so 
json 
_json.cpython-36m-arm-linux-gnueabihf.so 
_lsprof.cpython-36m-arm-linux-gnueabihf.so 
_lzma.cpython-36m-arm-linux-gnueabihf.so 
math.cpython-36m-arm-linux-gnueabihf.so 
_md5.cpython-36m-arm-linux-gnueabihf.so 
mmap.cpython-36m-arm-linux-gnueabihf.so 
_multibytecodec.cpython-36m-arm-linux-gnueabihf.so 
_multiprocessing.cpython-36m-arm-linux-gnueabihf.so 
nis.cpython-36m-arm-linux-gnueabihf.so 
_opcode.cpython-36m-arm-linux-gnueabihf.so 
ossaudiodev.cpython-36m-arm-linux-gnueabihf.so 
parser.cpython-36m-arm-linux-gnueabihf.so 
_pickle.cpython-36m-arm-linux-gnueabihf.so 
_posixsubprocess.cpython-36m-arm-linux-gnueabihf.so 
pyexpat.cpython-36m-arm-linux-gnueabihf.so 
_random.cpython-36m-arm-linux-gnueabihf.so 
resource.cpython-36m-arm-linux-gnueabihf.so 
select.cpython-36m-arm-linux-gnueabihf.so 
_sha1.cpython-36m-arm-linux-gnueabihf.so 
_sha256.cpython-36m-arm-linux-gnueabihf.so 
_sha3.cpython-36m-arm-linux-gnueabihf.so 
_sha512.cpython-36m-arm-linux-gnueabihf.so 
_socket.cpython-36m-arm-linux-gnueabihf.so 
spwd.cpython-36m-arm-linux-gnueabihf.so 
_ssl.cpython-36m-arm-linux-gnueabihf.so 
_struct.cpython-36m-arm-linux-gnueabihf.so 
syslog.cpython-36m-arm-linux-gnueabihf.so 
termios.cpython-36m-arm-linux-gnueabihf.so 
_testbuffer.cpython-36m-arm-linux-gnueabihf.so 
_testcapi.cpython-36m-arm-linux-gnueabihf.so 
_testimportmultiple.cpython-36m-arm-linux-gnueabihf.so 
_testmultiphase.cpython-36m-arm-linux-gnueabihf.so 
unicodedata.cpython-36m-arm-linux-gnueabihf.so 
xxlimited.cpython-36m-arm-linux-gnueabihf.so 
zlib.cpython-36m-arm-linux-gnueabihf.so 

私はのsys.path印刷する場合:

$ python3.6 
Could not find platform dependent libraries <exec_prefix> 
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] 
Python 3.6.1rc1+ (default, Mar 11 2017, 15:01:24) 
[GCC 4.9.2] on linux 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import sys 
>>> sys.path 
['', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/lib-dynload', '/home/pi/.local/lib/python3.6/site-packages', '/usr/lib/python3.6/site-packages'] 
>>> 

をあなたはPythonがそのディレクトリで検索されていることがわかります。

math.cpython-36m-arm-linux-gnueabihf.soなどの依存ライブラリをインポートしようとすると、

したがって、問題はplatform dependent librariesを意味し、デフォルトのパスはどこですか?

答えて

0

Python 3.6が正常にコンパイルされた場合は、.bashrcファイルにexport PYTHONHOME=/usr/localを追加してください。または、sysconfigファイルの接頭辞とexec_prefixを編集しますが、前者は単純な解決策です。

関連する問題