【问题标题】:Installing python package jieba3k changes version of already installed package jieba安装 python 包 jieba3k 更改已安装包 jieba 的版本
【发布时间】:2018-04-02 00:12:22
【问题描述】:

这是重现我的问题的方法:

创建一个新的虚拟环境:

$ virtualenv testenv --python=/usr/bin/python3.6 
Running virtualenv with interpreter /usr/bin/python3.6
Using base prefix '/usr'
New python executable in testenv/bin/python3.6
Also creating executable in testenv/bin/python
Installing setuptools, pip, wheel...done.
$ source testenv/bin/activate
(testenv) $ cd test

安装jieba并查看__version__:

(testenv) test$ pip3 install jieba
Collecting jieba
Installing collected packages: jieba
Successfully installed jieba-0.39
(testenv) test$ python
Python 3.6.5 (default, Mar 29 2018, 03:28:50) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import jieba
>>> jieba.__version__
'0.39'
>>> Quit (core dumped)

好的,0.39 版。

安装jieba3k:

(testenv) test$ pip3 install jieba3k
Collecting jieba3k
Installing collected packages: jieba3k
Successfully installed jieba3k-0.35.1

复查jieba__version__:

(testenv) test$ python
Python 3.6.5 (default, Mar 29 2018, 03:28:50) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import jieba
>>> jieba.__version__
'0.34'
>>> Quit (core dumped)

新版本是 0.34。

为什么会这样?我该如何避免这种情况?

【问题讨论】:

    标签: python pip dependencies


    【解决方案1】:

    jiebajieba3k 不是两个不同的包,它们是同一个包的两个不同版本,jieba 更新。当您安装 jieba3k 时,它会用旧版本覆盖包 jieba

    简而言之:忘记jieba3k,只使用jieba

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-06-13
      • 1970-01-01
      • 2018-11-10
      • 1970-01-01
      相关资源
      最近更新 更多