Anaconda Python virtualdev在Windows的Linux子系统上找不到libpython3.5m.so.1.0(Ubuntu 14.04)

Gar*_*son 7 python linux ubuntu virtualenv windows-subsystem-for-linux

我在Windows Anniversary Edition Linux子系统(WSL)上使用Anaconda 4.1.1安装了Python 3.5.2,它或多或少嵌入了Ubuntu 14.04.5 LTS.

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

pip install virtualenv
Run Code Online (Sandbox Code Playgroud)

然后我尝试在里面创建一个虚拟环境~/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
Run Code Online (Sandbox Code Playgroud)

很容易假设这只是一个WSL问题,但到目前为止其他所有工作都有效,而且我在Ubuntu上看到了类似的错误报告.知道问题是什么吗?

rll*_*rll 20

我没有遇到过同样的问题,或者试图复制WSL环境.但通常当其他库发生类似情况时,它很可能是一个配置不当的环境.你必须签出你的图书馆路径:

echo $LD_LIBRARY_PATH
Run Code Online (Sandbox Code Playgroud)

并确保保留的目录在libpython那里.如果不:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/the/py/lib/dir
Run Code Online (Sandbox Code Playgroud)

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

  • 就是这样!我将`export LD_LIBRARY ="$ LD_LIBRARY_PATH:$ HOME/anaconda3/lib"添加到我的`.bashrc`中,现在`virtualenv`正常工作.非常感谢你! (4认同)