Here's how to reproduce my issue:
Create a new virtualenv:
$ 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
Install jieba and check __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)
Ok, version 0.39.
Install jieba3k:
(testenv) test$ pip3 install jieba3k
Collecting jieba3k
Installing collected packages: jieba3k
Successfully installed jieba3k-0.35.1
Recheck 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)
New version is 0.34.
Why is this happening? And how can I avoid this?
jieba and jieba3k aren't two different packages, they are two different versions of the same package with jieba being newer. When you install jieba3k it overrides package jieba with older version.
In short: forget about jieba3k, use only jieba.
Related
I have installed wheel successfully as follows:
(py2.7) [abcd#cluster1830 ~]$ pip install /data/pythonlibs/wheel-0.29.0-py2.py3-none-any.whl
Processing /data/pythonlibs/wheel-0.29.0-py2.py3-none-any.whl
Installing collected packages: wheel
Found existing installation: wheel 0.30.0a0
Uninstalling wheel-0.30.0a0:
Successfully uninstalled wheel-0.30.0a0
Successfully installed wheel-0.29.0
Then I tried to use the following command to check the installed libraries,
(py2.7) [abcd#cluster1830 ~]$ pip freeze > /data/dump.txt
Opening the dump.txt, I cannot find the installed wheel library,
(py2.7) [abcd#cluster1830 ~]$ cat /data/dump.txt
protobuf==3.1.0.post1
six==1.10.0
At the same time, I tried import wheel from python,
(py2.7) [abcd#cluster1830 ~]$ python
Python 2.7.9 (default, Apr 11 2017, 10:32:43)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wheel
>>>
Looks like it works, which confuses me. Whether I have wheel library installed or not?
During my installing tensorflow, I had the following error message,
Could not find any downloads that satisfy the requirement wheel>=0.26 (from tensorflow-gpu==1.0.1)
No distributions at all found for wheel>=0.26 (from tensorflow-gpu==1.0.1)
1, I had a new linux with python=python2.7 and python3=python3.4
2, I installed pyenv by using git
3, I installed anaconda3-4.1.1 by using pyenv and set it as global via pyenv by using pyenv global anaconda3-4.1.1
4, I created a virtualenv by using pyenv virtualenv anaconda3-4.1.1 mytestenv
5, I use import numpy to test the result. In the original anaconda3-4.1.1 env it's OK for importing numpy, but in the mytestenv env there is no numpy.
Please see the details following:
(anaconda3-4.1.1) giza#DESKTOP-H8KC9QC:~$ pyenv versions
system
* anaconda3-4.1.1 (set by /home/giza/.pyenv/version)
(anaconda3-4.1.1) giza#DESKTOP-H8KC9QC:~$ pyenv virtualenv anaconda3-4.1.1 mytestenv
Fetching package metadata .......
Solving package specifications: ..........
Package plan for installation in environment /home/giza/.pyenv/versions/anaconda3-4.1.1/envs/mytestenv:
The following NEW packages will be INSTALLED:
openssl: 1.0.2j-0
pip: 8.1.2-py35_0
python: 3.5.2-0
readline: 6.2-2
setuptools: 27.2.0-py35_0
sqlite: 3.13.0-0
tk: 8.5.18-0
wheel: 0.29.0-py35_0
xz: 5.2.2-0
zlib: 1.2.8-3
Linking packages ...
[ COMPLETE ]|##########################################################################################################| 100%
#
# To activate this environment, use:
# $ source activate mytestenv
#
# To deactivate this environment, use:
# $ source deactivate
#
Installing pip from https://bootstrap.pypa.io/get-pip.py...
Requirement already up-to-date: pip in /home/giza/.pyenv/versions/anaconda3- 4.1.1/envs/mytestenv/lib/python3.5/site-packages
(anaconda3-4.1.1) giza#DESKTOP-H8KC9QC:~$ pyenv activate mytestenv
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
(mytestenv) giza#DESKTOP-H8KC9QC:~$ python
Python 3.5.2 |Continuum Analytics, Inc.| (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 numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'numpy'
>>> exit()
(mytestenv) giza#DESKTOP-H8KC9QC:~$ pyenv deactivate
(anaconda3-4.1.1) giza#DESKTOP-H8KC9QC:~$ python
Python 3.5.2 |Anaconda 4.1.1 (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 numpy
>>> exit()
(anaconda3-4.1.1) giza#DESKTOP-H8KC9QC:~$
I've got statsmodels 0.5.0 and I want to upgrade to the latest version which is 0.6.0.
So I do
$ git clone git://github.com/statsmodels/statsmodels.git
$ cd statsmodels
$ pip install .
But, I get an error:
error: can't copy 'statsmodels/nonparametric/_smoothers_lowess.c': doesn't exist or not a regular file
Apparently the solution is to install Cython (which I thought was already installed, or how could statsmodels 0.5.0 ever have worked in the first place..?!?).
Anyway, so it becomes:
$ git clone git://github.com/statsmodels/statsmodels.git
$ cd statsmodels
$ pip install cython
$ pip install .
$ python
Python 2.7.3 |CUSTOM| (default, Apr 11 2012, 17:52:16)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import statsmodels
>>> statsmodels.version.full_version
'0.6.0.dev-b472807'
I have two versions of Python installed on my centOS server.
[ethan#demo ~]$ python2.6 --version
Python 2.6.6
[ehtan#demo ~]$ python --version
Python 2.7.3
The older version (2.6) is required by some essential centOS packages so I can't remove it.
When I install packages using pip, they are being installed in Python 2.6. But instead I want them to be installed to Python 2.7.
How can I change this behaviour?
For example, here is what happened when I tried installing Wand
[ethan#demo ~]$ pip install Wand
Requirement already satisfied (use --upgrade to upgrade): Wand in /usr/lib/python2.6/site-packages
Cleaning up...
[ethan#demo ~]$ python2.6
Python 2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wand
>>> exit()
[ethan#demo ~]$ python
Python 2.7.3 (default, Oct 11 2013, 15:59:28)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import wand
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named wand
>>> exit()
Edit
I found this answer but it didn't work for me https://stackoverflow.com/a/4910393/3384340
You need to install pip for each python version separately.
In order to install pip for Python2.7, run
sudo easy_install-2.7 pip
Use pip-2.7 to install Wand
sudo pip-2.7 install Wand
I made a Python script that needs a libtiff module to run. Do you have any suggestions on how to install libtiff? I tried to do it using fink, but I got the following error:
Failed: no package found for specification libtiff!
I also installed libtiff using brew, and in this case I get
ImportError: No module named libtiff
Homebrew worked fine for me. Have you installed the Python bindings for libtiff? For example, ...
% brew install libtiff
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libtiff-4.0.3.mavericks.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libtiff-4.0.3.mavericks.bottle.tar.gz
/usr/local/Cellar/libtiff/4.0.3: 254 files, 3.8M
% brew install python
% pip install --upgrade setuptools
% pip install --upgrade pip
% pip install numpy
% pip install -e svn+http://pylibtiff.googlecode.com/svn/trunk/
% python
Python 2.7.6 (default, Mar 12 2014, 18:28:55)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtiff
>>> libtiff
<module 'libtiff' from '/Users/me/src/svn/libtiff/__init__.pyc'>
>>>