python3安装模块的命令_如何为PythonPython3安装gi模块?

你就是这样做的:(例如Linux Mint和python3)

首先使用发行版包管理器安装gi模块。对于Linux Mint,它将是:sudo apt-get install python3-gi

然后运行发行版python检查模块的位置:$ /usr/bin/python3

Python 3.5.2 (default, Sep 10 2016, 08:21:44)

[GCC 5.4.0 20160609] on linux

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

>>> import gi

>>> print(gi)

所以在我的例子中,模块gi被安装到/usr/lib/python3/dist-packages/gi。假设您的水蟒安装在/home/kossak/anaconda3中,请在适当的文件夹中创建到gi模块的链接:ln -s /usr/lib/python3/dist-packages/gi /home/kossak/anaconda3/lib/python3.5/site-packages/

如果您有conda虚拟环境并希望gi模块在那里可用,那么路径应该有所不同。假设虚拟环境称为TEST:ln -s /usr/lib/python3/dist-packages/gi /home/kossak/anaconda3/envs/TEST/lib/python3.5/site-packages/

它起作用:$ python3

Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 2 2016, 17:53:06)

[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux

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

>>> import gi

>>>

你可能感兴趣的:(python3安装模块的命令)