7

我在 Windows 周年版 Linux 子系统 (WSL) 上使用 Anaconda 4.1.1 安装了 Python 3.5.2,它或多或少是嵌入式 Ubuntu 14.04.5 LTS。

我使用以下方法安装了 virtualenv:

pip install virtualenv

然后我尝试在里面创建一个虚拟环境~/temp

user@host:~$ virtualenv ~/temp/test
Using base prefix '/home/user/anaconda3'
New python executable in /home/user/temp/test/bin/python
/home/user/temp/test/bin/python: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory
ERROR: The executable /home/user/temp/test/bin/python is not functioning
ERROR: It thinks sys.prefix is '/home/user' (should be '/home/user/temp/test')
ERROR: virtualenv is not compatible with this system or executable

很容易假设这只是一个 WSL 问题,但到目前为止一切正常,我在 Ubuntu 上看到过类似的错误报告。知道问题是什么吗?

4

2 回答 2

21

我没有遇到同样的问题,也没有尝试复制 WSL 环境。但通常当其他库发生类似情况时,它很可能是一个配置不当的环境。您必须检查您的库路径:

echo $LD_LIBRARY_PATH

并确保保存的目录在libpython那里。如果不:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/the/py/lib/dir

将最后一行添加到您的.bash_profile.bashrc使其永久化。

于 2016-09-07T12:44:17.257 回答
2

矿山解决方案:

打开一个外壳

cd
vim .bashrc

添加一行

export LD_LIBRARY_PATH=~/anaconda3/lib
于 2017-08-22T12:23:46.737 回答